Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- done = false
- -- The algorithm will be ran 1/2 of the amount variable.
- amount = 1000
- x = 3
- numpi = 1
- while x < amount do
- numpi = numpi - 1/x
- x = x + 2
- numpi = numpi + 1/x
- x = x + 2
- print(numpi * 4)
- end
- if x > amount and done == false then
- numpi = numpi * 4
- print(numpi)
- print("Depending on how big the 'amount' variable is, is how accurate PI is")
- done = true
- end
- stop = io.read()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement