Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --inputs
- inp = 1
- num = 24
- --functions
- function removedeci(x)
- local y = tostring(x)
- for i=1,#y do
- if string.sub(y,i,i) == "." then
- return tonumber(string.sub(y,1,i-1))
- end
- end
- end
- function isdeci(x)
- local y = tostring(x)
- for i=1,#y do
- if string.sub(y,i,i) == "." then
- if string.sub(y,i+1,i+1) == "0" and string.sub(y,i+2,i+2) == "" then
- return false
- else
- return true
- end
- end
- end
- return false
- end
- for i=1,999,inp do
- if isdeci(num/i) == false then
- 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")
- else
- break
- end
- end
Add Comment
Please, Sign In to add comment