Write a function to ask for given number and report whether they are between 10 and 100 or not

1 回表示 (過去 30 日間)
ICD
ICD 2019 年 3 月 7 日
編集済み: Rena Berman 2021 年 5 月 7 日
この 質問 は Rik さんによってフラグが設定されました
please try
  2 件のコメント
Rik
Rik 2020 年 11 月 18 日
編集済み: Rena Berman 2021 年 5 月 7 日
Why did you flag your own question and the answer?

サインインしてコメントする。

回答 (1 件)

CP
CP 2019 年 3 月 7 日
This is extrememly simple.
function checkNumber()
tmp = input('Enter a Number: ');
inBetween10and100 = tmp >= 10 && tmp <= 100;
if(inBetween10and100 == true)
fprintf('The value %.2f is between 10 and 100\n',tmp);
else
fprintf('The value %.2f is NOT between 10 and 100\n',tmp);
end
end

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by