Advertisement
Ruslan_Isaev

Simple calculator

Feb 6th, 2016
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. print('My  super  calculator')
  2. print('Ruslan  Isaev  2016')
  3. function loop()
  4. print('first  number')
  5. first=io.read()
  6. print('second  number')
  7. second=io.read()
  8. print('What  to  do  with them')
  9. op=io.read()
  10. print('RESULT:')
  11. if(op=='+') then
  12.   print(first+second)
  13. end
  14. if(op=='-') then
  15.   print(first-second)
  16. end
  17. if(op=='*') then
  18.   print(first*second)
  19. end
  20. if(op=='/') then
  21.   print(first/second)
  22. end
  23. if(op=='^') then
  24.   print(first^second)
  25. end
  26. loop()--When  function  ended  do  it  again
  27. end
  28. loop()--At  start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement