Sub Calc()6 S7 v6 F2 D! J. O6 F; i& u
Dim c As Long, j As Long, k As Long, p As Single6 d1 W$ b( Y1 C6 B
Dim a As Single) ~; M: M- |. [
Dim b As Single' y+ o8 w9 P; r9 L
m/ _& D9 n7 u! f8 X% p' ]
c = Val(InputBox("")) 'If c is large enough...; h1 s' G& W" E. \" ]1 W
& d, R t3 W7 |+ ?+ K/ [9 e For j = 1 To c! l4 ~9 r P+ m* n
a = Rnd
+ ?8 @4 G- M6 f3 h# S b = Rnd
' R: R2 t" D7 j+ b# @ If a ^ 2 + b ^ 2 <= 1 Then k = k + 1
# b" y8 Y( v) N: M( j Next j- D2 j9 K7 m6 H* ^
; f* M: { Q+ D) \* G: {# Y p = k / j * 4 'What p is...3 k- C9 s6 p) O' A9 S* b& a
End Sub |