How do I use a while loop to keep asking for input of even numbers?
1 view (last 30 days)
Show older comments
How do I aks user to input an even number but if the number is odd or equal to 0, it should keep asking for input?
0 Comments
Accepted Answer
KSSV
on 18 Jan 2019
prompt = 'Enter a number:';
S = input(prompt) ;
if mod(S,2)
S = input(prompt) ;
end
More Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements 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!