Repeat input prompts until conditions are met or until prompts asked 3 times
Show older comments
I have three input prombts and I'm supposed to ask the user to input values until the conditions are met. The values for each prompt must be greater than zero and the last prompt has to have a length of 3.
The three prombts are
W=input('Type the values of W:');
d=input('Type the values of d:');
Er=input('Type the value of Er:');
I'm supposed to use a while loop to repeat the prompts until the conditions are met or to simply stop once the user has inputted the wrong values for the third time. Everytime I try to make the while loop it either loops forever if the conditions aren't met or it simply takes the values given even if they are wrong. How can I use a while to repeat the input prompts ony three times if the conditions aren't met.
Accepted Answer
More Answers (0)
Categories
Find more on Debugging and Improving Code in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!