Advertisement
LDDestroier

Pi Calculator

May 1st, 2015
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.34 KB | None | 0 0
  1. term.redirect(term.native())
  2. itemX, itemY = term.getCursorPos()
  3. pi = 3
  4. a = 2
  5. b = 3
  6. c = 4
  7. function addThem(number)
  8.     a = a + number
  9.     b = b + number
  10.     c = c + number
  11. end
  12. while true do
  13.     pi = pi + 4/(a*b*c)
  14.     addThem(2)
  15.     pi = pi - 4/(a*b*c)
  16.     addThem(2)
  17.     term.setCursorPos(itemX,itemY)
  18.     write(pi)
  19.     if a % 4 == 0 then sleep(0) end
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement