Advertisement
Guest User

calc

a guest
May 19th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. function RectArea(length, width)
  2.  area = length * width
  3. print(area)
  4. end
  5.  
  6. function SumOut(length, width)
  7. sum = length + width
  8. print(sum)
  9. end
  10.  
  11.  
  12. function RectPerimeter(length, width)
  13.  
  14. perimeter = 2* length + width * 2
  15. print(perimeter)
  16. end
  17.  
  18. q = 0
  19.  
  20. while(q ~= "q" ) do
  21.  
  22. print("what is length?")
  23. storeLength =tonumber(read())
  24. print("what is width?")
  25. storeWidth =tonumber(read())
  26.  
  27. print("q to exit")
  28. q = read()
  29.  
  30. print("area")
  31. RectArea(storeLength, storeWidth)
  32.  
  33.  
  34. print("perimeter")
  35. RectPerimeter(storeLength, storeWidth)
  36.  
  37. print("sum")
  38. SumOut(storeLength,storeWidth)
  39.  
  40.  
  41.  
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement