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

1 次查看(过去 30 天)
此 个问题 已被 Rik 标记
please try

回答(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 CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by