Sub Calc()* y. x7 {7 |/ [9 a- B: j# [* P
Dim c As Long, j As Long, k As Long, p As Single
0 [6 Z1 P1 N: `- n6 B Dim a As Single" l, X! t2 I6 }8 w5 U; t
Dim b As Single* a; x l+ Y- n7 i
- C& m: i4 T" |; H; D' v! q
c = Val(InputBox("")) 'If c is large enough...# q$ D, L9 T' J# v
" ~- P) }( \; o! r; A For j = 1 To c% w5 X6 y& q/ l2 p' l8 Q3 s
a = Rnd( `- B2 m2 v! ?
b = Rnd% z+ X" o7 \- ^6 y9 \
If a ^ 2 + b ^ 2 <= 1 Then k = k + 1
! u- y' N/ H- g# A0 B! i d( e0 ? Next j( Z' Z. N" w- a$ p6 r
6 g0 [+ E- I6 ~! `
p = k / j * 4 'What p is...2 S( Y, U( n+ [3 @& n
End Sub |