How do I write a script that keeps asking the user to enter a number until the sum of the numbers they have entered is bigger than 10?

This is what I have so far. I know it isn't correct, but I think it is a start.
if true
Total = 0;
k = 1;
while (Total<10);
Total = k + input('Please input a number:');
end
end
Also, I am trying to do this without the sum function.

 採用された回答

Jon
Jon 2015 年 7 月 17 日
Not sure why you have the k variable...see if this does what you want:
Total = 0;
while (Total<10);
Total = Total + input('Please input a number:');
end

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

タグ

質問済み:

2015 年 7 月 17 日

コメント済み:

2015 年 7 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by