|
Post by Felktor on Apr 1, 2017 23:40:00 GMT
--Code:
while true do w=io.read(print('Solve for leg c(c) or leg b/a(b)')) if w ~= 'c' and w ~= 'b' then print'invalid' a = 'i' end if a ~= 'i' then ro=io.read(print'Round the answer? y/n (whole number)') else a = 'weeee' end if w=='c' then a=io.read(print('Leg a?')) a=a^2 b=io.read(print('Leg b?')) b=b^2 answ=(b+a)^(1/2) if ro=='n' then print('the answer is '..answ) else answ=math.floor(answ+.5)print('The answer is ' .. answ) end elseif w=='b' then print'Leg a?' a=io.read()^2 print'Leg c?' c=io.read()^2 answ=(c-a)^(1/2) if ro=='n' then print('The answer is '..answ) else answ=math.floor(answ+.5) print('The answer is ' ..answ) end end end
|
|
|
Post by penis on Apr 1, 2017 23:40:41 GMT
Lol meme
|
|
|
Post by Guy on Apr 3, 2017 20:40:54 GMT
I rly like the "weeee" you put, lol You can reorganize your code to be a lot neater, tho:
while true do w=io.read(print('Solve for leg c(c) or leg b/a(b)')) if w ~= 'c' and w ~= 'b' then print'invalid' else ro=io.read(print'Round the answer? y/n (whole number)') a=io.read(print('Leg a?'))^2 if w=='c' then b=io.read(print('Leg b?'))^2 answ=(b+a)^(1/2) else c=io.read(print('Leg c?'))^2 answ=(c-a)^(1/2) end if ro=='y' then answ=math.floor(answ+.5) end print('The answer is ' .. answ) end end
|
|
|
Post by Felktor on Apr 5, 2017 0:24:43 GMT
I like the code clumped ;p
|
|