Sub Calc()
' b. H( r( b2 L0 w: s Dim c As Long, j As Long, k As Long, p As Single
4 b& U; M. B+ ]9 d6 { S; i Dim a As Single& s3 ?# n+ a1 J
Dim b As Single
+ ~/ y0 m- Q2 q! |% C 6 R0 b. V9 s% H1 q. |
c = Val(InputBox("")) 'If c is large enough...
& H* @1 _, ~5 y2 G " {, A( X' L9 ?' Y$ H3 `
For j = 1 To c
: o1 x! t6 H% V' K% U% r' v2 Z0 L a = Rnd8 n6 ?" V' P. V& t
b = Rnd
( N' B+ L. u) g. }& O+ m$ O1 z+ F! y If a ^ 2 + b ^ 2 <= 1 Then k = k + 1* C6 Y/ n @! f: J/ B
Next j% B; n q- n/ ~; Z' q2 s; @! e# `
# [, z" O9 T. ^# A3 Y$ d p = k / j * 4 'What p is...+ D# W% E% s" [9 G+ K1 c1 L$ |5 w0 R. I
End Sub |