Sub Calc()9 S$ T" r- Z* g% L3 s
Dim c As Long, j As Long, k As Long, p As Single" l+ W# `6 S* H! n; |
Dim a As Single
" T1 E6 n' B5 j) { Dim b As Single
9 `; T6 D2 K/ p9 b ! N G2 X7 n& I4 x- \0 p/ X
c = Val(InputBox("")) 'If c is large enough...
* |+ E2 p( {6 i
- j k, ~+ X L2 K, c( D For j = 1 To c R/ z1 N0 u& X. b' S- u9 Z
a = Rnd# G. V7 f% a3 g, c% K2 l
b = Rnd
3 {) g2 Q' S: L4 j8 A If a ^ 2 + b ^ 2 <= 1 Then k = k + 1# k( e$ [- }8 b3 A6 I/ u
Next j% o/ e, \3 P+ @+ `( W
2 l1 U$ W$ T, r. \ p = k / j * 4 'What p is...
8 P3 a4 v% \7 ]; `End Sub |