Sub Calc()
1 t+ a+ Q s3 w' P3 G1 K2 H Dim c As Long, j As Long, k As Long, p As Single. {& C: y( F+ g: g! g( t
Dim a As Single& U& {& j; ^5 A* Y5 x2 U6 m
Dim b As Single
; l& L6 ^* U$ c/ I% Q/ W
+ A$ d0 @9 y. C& v+ P3 L c = Val(InputBox("")) 'If c is large enough...
! ?( Z! U# d( z- S: v
' p4 X, Z/ t( E8 [: l+ W& B! g5 D For j = 1 To c2 B F0 K" K. m
a = Rnd& S# Y0 f" a) g8 g3 z( B) w0 q% }
b = Rnd1 I" w! ^2 _7 y0 O9 \3 U
If a ^ 2 + b ^ 2 <= 1 Then k = k + 1
/ m3 i: B- O8 }: {2 c$ K Next j2 j' Q' n( A% x5 b( Y6 v* `
7 j& C3 L& S+ s0 C% {
p = k / j * 4 'What p is..., e0 y/ e1 P- P
End Sub |