Click the flag to begin the program.
Program randomly selects a point on the screen and determines if it is red or blue. If the pixel is red, the point is assumed to be inside the circle, and variable inside increases by one. If the pixel is blue, the point is assumed to be outside the circle and variable outside increases by one. The area of blue can be thought of as 4 - pi if the square is 2 units x 2 units The area of red is pi (radius 1 squared times pi) So pi = inside * 4 / (inside + outside) 4 * pi / (pi + 4 - pi) = pi 4 * pi / 4 = pi pi = pi