lua - How to use if/then/else correctly here? -
lua - How to use if/then/else correctly here? -
how can prepare this,when run,it not solve a,b,c,it outputs enter,for example,i come in 3,b,5,it outputs 3,b,5,not 3,4,5!please note,the trig ratio's not complete,and copied them in.
print("welcome right triangle solver") print("what side a?enter if unknown!") a=io.read() print("what side b?enter b if unknown!") b=io.read() print("what side c?enter c if unknown!") c=io.read() print("what angle a?enter if unknown!") a=io.read() print("what angle b?enter b if unknown!") b=io.read() print("what angle c?enter c if unknown!") c=io.read() if == "string" a=math.sqrt(c^(2)-b^(2)) elseif b == "string" b=math.sqrt(c^(2)-a^(2)) elseif c == "string" c=math.sqrt(a^(2)+b^(2)) end print("great!") print("calculating") print("side is=" .. a) print("side b is=" .. b) print("side c is=" .. c) print("side is=" .. a) print("side b is=" .. b) print("side c is=" .. c) print("done") print("what name? ") name=io.read() print("thank you," .. name) print("how day?") day=io.read() print("mine too,bye!") io.read()
if b == "string"
should be
if b == "b"
lua
Comments
Post a Comment