問題一覧
お問い合わせ
light_mode
dark_mode
貯金のシミュレーション (while文) (Python)
問題
目標金額と1日の貯金額を読み込み、while 文で目標に届くまでの日数を求めるプログラムです。
入力例
10000 300
出力例
34日で10200円たまります
スタート
残り時間:
00:00
速度:
0
文字/分
参照コード
コピーはできません。自分でタイピングしてください。
goal, per_day = map(int, input().split()) total = 0 days = 0 while total < goal: total += per_day days += 1 print(f"{days}日で{total}円たまります")
入力エリア
コンパイル&実行
3