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