BobMe

random math thing to cheat later

Dec 3rd, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. --inputs
  2. inp = 1
  3. num = 24
  4. --functions
  5. function removedeci(x)
  6. local y = tostring(x)
  7. for i=1,#y do
  8. if string.sub(y,i,i) == "." then
  9. return tonumber(string.sub(y,1,i-1))
  10. end
  11. end
  12. end
  13.  
  14. function isdeci(x)
  15. local y = tostring(x)
  16. for i=1,#y do
  17. if string.sub(y,i,i) == "." then
  18. if string.sub(y,i+1,i+1) == "0" and string.sub(y,i+2,i+2) == "" then
  19. return false
  20. else
  21. return true
  22. end
  23. end
  24. end
  25. return false
  26. end
  27. for i=1,999,inp do
  28. if isdeci(num/i) == false then
  29. print("B = "..i.."cm h = "..removedeci(num/i).."cm | P = 2("..i.."cm) + 2("..removedeci(num/i).."cm) = "..(2*(i)+2*(removedeci(num/i))).."cm")
  30. else
  31. break
  32. end
  33. end
Add Comment
Please, Sign In to add comment