How to write a code to chose any number between two numbers?
2 次查看(过去 30 天)
显示 更早的评论
Hello, I am wondering how to write a code that allows the user to choose a number between two other numbers? For example, have (x>=0) and (x<=20). Thank you.
0 个评论
采纳的回答
ABHINANDAN SINGH
2017-3-1
编辑:ABHINANDAN SINGH
2017-3-1
This can help,don't forget to accept answer.
a =input("Enter a number between 0 to 20 ");
if and(le(0,a),le(a,20))
fprintf ("Your entered number is %d\n",a)
else
disp ("Invalid")
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Biological and Health Sciences 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!