Add up to five · 5まで足し合わせる
Add up to five
Use a while loop to add 1 + 2 + 3 + 4 + 5 into total. total should end as 15.
Two things change every time round: the running total, and the counter n. Miss the counter and the loop never ends; miss the total and it ends with nothing in it.
5まで足し合わせる
while ループを使って 1 + 2 + 3 + 4 + 5 を total に加算します。total は最終的に 15 となるべきです。
ループの繰り返しごとに2つの変化が生じます:累積値の total と counter(カウンタ)の n です。カウンタを忘れるとループは終わらず、合計値を忘れると結果が空になってしまいます。
Use a while loop to add 1 + 2 + 3 + 4 + 5 into total. total should end as 15. · while ループを使って 1 + 2 + 3 + 4 + 5 を total に加算します。total は最終的に 15 となるべきです。
Click Run to see the output here. · 実行ボタンをクリックして出力を確認してください。