Sub Calc()
5 M+ Z4 k( {/ m' B# p% Y Dim c As Long, j As Long, k As Long, p As Single
$ @' @7 \- f- q Dim a As Single) {, x" Q- f7 {& l! b5 w' E( E5 M u
Dim b As Single( r( ?0 n7 [6 ^6 M1 {
1 P) g* Z/ @6 o) s4 Q) ^
c = Val(InputBox("")) 'If c is large enough...
8 p. f8 K- y5 @
5 W: i6 A: b+ L2 W( Z' W& t For j = 1 To c
6 L& B* K' f7 E; }. W2 o6 U* w6 e& p a = Rnd
- U& p2 T, l1 D1 f1 x" p; ~ b = Rnd! h& Z( H9 ` Z% f
If a ^ 2 + b ^ 2 <= 1 Then k = k + 1
8 ?) Z* i: U) D9 V0 ? Next j0 T- ]5 S5 d1 G" A
5 [- s* r3 t2 _+ t
p = k / j * 4 'What p is...
9 K! V0 g5 C! F: z0 @End Sub |