Sub Calc()0 E& @% s m& N6 v3 t
Dim c As Long, j As Long, k As Long, p As Single
8 Y+ m2 J' l- X c8 {/ k/ J8 F0 M Dim a As Single- p0 p' X" E) a j) `6 g
Dim b As Single" e X4 }6 s7 N; E z
! v; h; b0 h$ I2 t+ x! b# z
c = Val(InputBox("")) 'If c is large enough...
8 l! `- Y5 P# M$ m( E 6 o* Y& l- F. s. Z
For j = 1 To c. v. v% E8 M: e+ r* ^6 l8 `+ f, a
a = Rnd
0 T" C+ b- I* o1 w$ O$ I4 X6 U b = Rnd5 B: r/ ?2 u2 ?9 l
If a ^ 2 + b ^ 2 <= 1 Then k = k + 1+ [/ V9 C, N. T5 y, d
Next j+ G9 j0 X8 t1 {2 G& G
" b6 \# {( ~, E: T4 \, y
p = k / j * 4 'What p is...
' i- z* ~- G z1 vEnd Sub |