Sub Calc()
v8 q W/ ^: |$ H( r" F" l Dim c As Long, j As Long, k As Long, p As Single
7 Z4 T! q' I5 ] Dim a As Single
+ D& ^/ [; t# ~9 B: M Dim b As Single
3 Z, C0 P) z( h( k1 }" H. c : K C: _9 F/ c+ B* Q
c = Val(InputBox("")) 'If c is large enough..." q/ [6 s) S4 a3 A' w
8 {, H3 h% }- `$ `( U, k$ q For j = 1 To c( d/ @1 @, d3 X8 L# L
a = Rnd) Z$ J/ Y2 w& k8 m
b = Rnd# `8 z* E; `6 o0 c1 `: Q* i
If a ^ 2 + b ^ 2 <= 1 Then k = k + 1
( `7 |4 k# b' s4 J6 P- ^' \% R( b! H Next j* Y* ~) J l7 r3 ^5 Z8 U
/ ]; w" N5 f' L$ f6 L
p = k / j * 4 'What p is...
1 y7 s, D. K+ Y. _7 v. B$ KEnd Sub |