セクション 4. 章 7
single
Challenge: do-while Loop
メニューを表示するにはスワイプしてください
タスク
スワイプしてコーディングを開始
In this task, you will practice using a do-while loop to simulate a real-life scenario: saving money daily until reaching a target amount.
- Inside the
CalculateSavingsmethod:- Initialize
totalSavedto0. - Initialize
daysto0. - Use a do-while loop to:
- Add
dailySavingtototalSavedeach day. - Increment
daysby 1. - Repeat the loop until
totalSavedis greater than or equal totargetAmount.
- Add
- Initialize
解答
すべて明確でしたか?
フィードバックありがとうございます!
セクション 4. 章 7
single
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください