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

1 visualización (últimos 30 días)
Rik ha marcado con alerta este/a pregunta
please try

Respuestas (1)

CP
CP el 7 de Mzo. de 2019
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

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by