Repeating loop until input conditions are met
显示 更早的评论
For my program, I need to input two sides and one angle of a triangle. If the angle input is above 180 degrees, I need to loop back to input a new angle. This process needs to repeat until the condition a1<180 is met.
Here's my program so far, which only prompts the user that the triangle is impossible once

I've looked at other forums on "looping until condition is met", but very few of them deal with inputs, so I don't really know where to begin with a for/while loop.
1 个评论
Subhamoy Saha
2020-3-25
编辑:Subhamoy Saha
2020-3-25
You have to check whether angle is > 180. If yes then again take input for angle certainly after displaying the message.
take input for angle
start the loop: check whether input value>180
display msg
again take input for angle
end the loop
NB Direct answers cannot be given for textbook problems.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!