#include #define nx 100 #define ny 100 main() { int i, j, m; double p, x, y; m = 0; for(i = 0; i < nx; ++i){ x = (((double) i) +0.5)/((double) nx); for(j = 0; j < ny; ++j){ y = (((double) j) +0.5)/((double) ny); if((x*x+y*y) < 1.0 ){ m = m + 1; } } } p=((double) 4 * m)/((double) nx * ny); printf("%d %d %13.10f\n", nx, ny, p); }