Sub Calc()
8 t, B# m2 M# x4 m Dim c As Long, j As Long, k As Long, p As Single
1 L1 ?$ W% b' ?% u$ ? Dim a As Single
- N- F8 U& R+ Q5 K Dim b As Single2 [# H2 X% o, U
/ t& G8 y" w& U7 m; n c = Val(InputBox("")) 'If c is large enough...
# w. |) E1 m- ~2 h P2 P- N ( J ?% X3 |1 H( O) T3 u
For j = 1 To c. v8 s5 A3 K9 n$ A M* y
a = Rnd
* l g+ v8 L7 @0 b, O7 D/ P3 d0 K b = Rnd' _/ Q+ F& D4 R. f7 |9 @, Z5 S; i# b
If a ^ 2 + b ^ 2 <= 1 Then k = k + 1
# X0 K( ? a$ z( u Next j
5 M' {0 w3 B2 q i! q( C
j8 F5 }8 C9 Y7 }) |/ l3 r p = k / j * 4 'What p is..." B7 e3 ]: h( U* `4 I5 p0 d
End Sub |