Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

why not it work between 1 and 10?

조회 수: 1 (최근 30일)
bijay kumar
bijay kumar 2018년 8월 14일
마감: MATLAB Answer Bot 2021년 8월 20일
clc
num = input('enter a number between 1 and 10:->');
if (num < 1 && num > 10)
disp('invalid number')
else
disp('valid number')
end
  댓글 수: 4
Dennis
Dennis 2018년 8월 14일
if num < 1 || num > 10
bijay kumar
bijay kumar 2018년 8월 14일
thank u Dennis.

답변 (1개)

Dennis
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

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by