MATLAB While Adder? Write a MATLAB program named whileadder

2 ビュー (過去 30 日間)
Shalene
Shalene 2014 年 11 月 9 日
回答済み: Image Analyst 2014 年 11 月 10 日
Write a MATLAB program named whileadder , to
Input a desired maximum value. Be sure it is one value only Compute a running total by ones Return as output the last integer that can be added before the total exceeds max
For example, if input max = 60, the output should = 10, because 1+2+3+4+5+6+7+8+9+10 = 55 and adding 11 would make the sum > 60. If max = 55, then the output would be = 10.

回答 (1 件)

Image Analyst
Image Analyst 2014 年 11 月 10 日

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by