Finding maximum integer between [100,200] divisible by 21?
11 次查看(过去 30 天)
显示 更早的评论
I want use "for" and "while" to get the result.
1 个评论
Jan
2018-11-21
This sounds like a homework question. Using for and while will be hard, but one or the other is smart enough. Please post, what you have tried so far and ask a specific question. The forum will not solve your homework. You need one line of code only, therefore it is hard to give some hints without posting the complete solution.
回答(2 个)
Jan
2018-11-21
Hints:
- The vector of number from 100 to 200:
100:200
- Dividable by 21:
mod(x, 21) == 0
- The maximum value can be found by the max() command, or by find(y, 1, 'last')
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!