why not it work between 1 and 10?
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
clc
num = input('enter a number between 1 and 10:->');
if (num < 1 && num > 10)
disp('invalid number')
else
disp('valid number')
end
4 commentaires
Stephen23
le 14 Août 2018
num < 1 && num > 10
Can you give us an example of a number that is both less than one AND greater than ten?
bijay kumar
le 14 Août 2018
Dennis
le 14 Août 2018
if num < 1 || num > 10
bijay kumar
le 14 Août 2018
Réponses (1)
Dennis
le 14 Août 2018
I think it is unlikely, that one number is smaller than 1 and bigger than 10 at the same time.
num = input('enter a number between 1 and 10:->');
if num > 1 && num < 10
disp('valid number');
else
disp('invalid number')
end
Cette question est clôturée.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!