#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
int main(void) {
srand(time(NULL));
int niter, inside_dots = 0;
double x, y, z, pi;
printf("¹Ýº¹È½¼ö: ");
scanf("%d", &niter);
inside_dots = 0;
for (int i = 0; i < niter; i++) {
x = (double)rand() / RAND_MAX;
y = (double)rand() / RAND_MAX;
z = x * x + y * y;
if (z <= 1) inside_dots++;
}
pi = (double)inside_dots / niter * 4;
printf("ÆÄÀÌ = %lf\n\n", pi);
return(0);
}