Sub Calc()8 v8 N5 z' i Z1 k `& i0 F3 c1 L
Dim c As Long, j As Long, k As Long, p As Single5 H0 E6 d% R7 [) {; k
Dim a As Single) i" [0 u* r. @1 W
Dim b As Single
+ Y: l& Q4 K) @3 Y: `# {
% O, Q$ ^ }( w# A c = Val(InputBox("")) 'If c is large enough...
5 h! U. V- F2 A6 k, |* g9 u8 D : u: U) `. q# j+ A: x6 O, v/ b5 {
For j = 1 To c3 D/ D/ S4 q0 \9 u
a = Rnd
+ V; d( m1 e' q+ D% u, k8 q b = Rnd
* V5 m% t" R4 r( i7 M E4 c6 G If a ^ 2 + b ^ 2 <= 1 Then k = k + 1! a) g) X% H( J9 @$ u- }1 ~
Next j
5 M9 u: ^1 l: h* x 6 z$ B' z5 ?1 V3 k) A
p = k / j * 4 'What p is.... B0 j1 j* u" t2 O9 j# |# P
End Sub |