code Ran=1, CrLf=9; code real RlOut=48; func real MontePi(N); \Calculate pi using Monte Carlo method int N; \number of randomly selected points int I, X, Y, C; def R = 10000; \radius of circle [C:= 0; \initialize count of points in circle for I:= 0 to N-1 do [X:= Ran(R); Y:= Ran(R); if X*X + Y*Y <= R*R then C:= C+1; ]; return float(C)*4.0 / float(N); \Acir/Asqr = pi*R^2/4*R^2 = pi/4 ]; [RlOut(0, MontePi( 100)); CrLf(0); RlOut(0, MontePi( 10_000)); CrLf(0); RlOut(0, MontePi( 1_000_000)); CrLf(0); RlOut(0, MontePi(100_000_000)); CrLf(0); ]