Sub Calc()
$ n+ ]0 p0 Q5 q3 W Dim c As Long, j As Long, k As Long, p As Single
6 Y- ~' f" F3 J1 m Dim a As Single }: s4 T$ Q! q8 q
Dim b As Single% E+ U' K1 K6 S' j
" b1 v, S: Z# |& H
c = Val(InputBox("")) 'If c is large enough...4 s3 S" f2 w: P8 N8 `% p
# E `6 H" }6 F# M* `& d For j = 1 To c. t6 a, F" l }$ P9 ~; ~0 E
a = Rnd
8 C( I9 W' P1 I3 O' g4 p b = Rnd& n% R( ]4 M; P8 z* Y0 m; ^
If a ^ 2 + b ^ 2 <= 1 Then k = k + 1: e) N9 G+ z* l3 ~5 G
Next j0 D+ I% G& ?& d1 }1 f0 _8 v% a# i
; z1 {* ? R- K# i1 Y( x: R p = k / j * 4 'What p is...7 u9 ]0 Z/ z, h! F) }* c
End Sub |