why not it work between 1 and 10?
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
clc
num = input('enter a number between 1 and 10:->');
if (num < 1 && num > 10)
disp('invalid number')
else
disp('valid number')
end
댓글 수: 4
Stephen23
2018년 8월 14일
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
2018년 8월 14일
Dennis
2018년 8월 14일
if num < 1 || num > 10
bijay kumar
2018년 8월 14일
답변 (1개)
Dennis
2018년 8월 14일
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
댓글 수: 0
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!