Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

why not it work between 1 and 10?

1 visualización (últimos 30 días)
bijay kumar
bijay kumar el 14 de Ag. de 2018
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
clc
num = input('enter a number between 1 and 10:->');
if (num < 1 && num > 10)
disp('invalid number')
else
disp('valid number')
end
  4 comentarios
Dennis
Dennis el 14 de Ag. de 2018
if num < 1 || num > 10
bijay kumar
bijay kumar el 14 de Ag. de 2018
thank u Dennis.

Respuestas (1)

Dennis
Dennis el 14 de Ag. de 2018
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

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by