#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
 double x, y, z;
 int iter[] = {10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 0}, i, j, k = 0, count;
 for (i = iter[k]; i; i = iter[++k]) {
  count = 0;
  for (j = 0; j < i; j++) {
   x = (double)rand() / RAND_MAX - 0.5;
   y = (double)rand() / RAND_MAX - 0.5;
   z = (double)rand() / RAND_MAX;
   if (sqrt(x * x + y * y) <= 0.5 && 0. <= z && z <= 1.)
    count++;
  }
  printf("ITER = %d, V = %f\n", iter[k], (double)count / iter[k]);
 }
 printf("Vの真の値 = %f\n", M_PI * 0.5 * 0.5);

 return 0;
}