Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program to calculate pi
#5
Here's my dartboard solution  Cool

Code: (Select All)
RANDOMIZE TIMER
CONST N& = 10000000
FOR i& = 1 TO N&
    x! = RND * 2 - 1
    y! = RND * 2 - 1
    h& = h& - (x! * x! + y! * y! < 1)
NEXT i&
PRINT h& / N& * 4

I was going to add graphics of darts being thrown at the dartboard but I can procrastinate well enough without going to those extremes!

And, yes, I know it's a rubbish solution but it's kinda fun Smile
RokCoder - dabbling in QB64pe for fun
Reply


Messages In This Thread
Program to calculate pi - by Kernelpanic - 02-26-2023, 10:18 PM
RE: Program to calculate pi - by david_uwi - 03-04-2023, 07:29 PM
RE: Program to calculate pi - by Kernelpanic - 03-04-2023, 10:51 PM
RE: Program to calculate pi - by bplus - 03-04-2023, 11:43 PM
RE: Program to calculate pi - by RokCoder - 03-06-2023, 12:04 PM
RE: Program to calculate pi - by BSpinoza - 03-06-2023, 05:05 PM
RE: Program to calculate pi - by bplus - 03-06-2023, 06:18 PM
RE: Program to calculate pi - by RokCoder - 03-06-2023, 07:29 PM
RE: Program to calculate pi - by JRace - 03-07-2023, 12:34 AM



Users browsing this thread: 1 Guest(s)