Sub Calc()$ ^/ j M. k6 T. {6 I
Dim c As Long, j As Long, k As Long, p As Single
6 M) _5 w9 ]- s* ^+ s Dim a As Single4 _2 |7 x5 X! m) z' C4 o( V
Dim b As Single
: m8 O9 `/ ~8 k# F9 A; f+ M; G0 s
& x5 m1 p5 E: H& ?9 |' {( b5 e c = Val(InputBox("")) 'If c is large enough...
0 z, q2 m/ z) j- S# _/ ]$ h! C 8 F2 A& x9 Q8 G z$ M/ ]) A* A
For j = 1 To c
, i9 A. d) T+ e a = Rnd$ E* ~. d- A' A& h6 E( }, g
b = Rnd
- _5 K ~+ R, W- `; g If a ^ 2 + b ^ 2 <= 1 Then k = k + 1
# P7 `" o+ v/ J! y/ R+ v, D Next j
) h& r) x& M; ~0 J9 Z
9 {1 ~# u. Q3 B8 q& i p = k / j * 4 'What p is...' u+ x+ D# b5 g) D6 O# K
End Sub |