Make a code that tells if a number is odd or even
Mostra commenti meno recenti
Risposte (1)
Bruno Teramoto
il 26 Set 2019
0 voti
x=input('Enter an integer:\n')
while round(x)~=x % use sentinel while loop if you are asked to make sure that
entered value is an integer
x=input('You entered invalid number. \nPlease Enter an integer:')
end
if rem(x,2)==0
fprintf('The Entered number is EVEN\n')
else
fprintf('The Entered number is ODD\n')
end
1 Commento
James Tursa
il 26 Set 2019
Please don't post complete solutions to homework questions.
Categorie
Scopri di più su Programming in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
