Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.
You owe B dollars (float). Each month you pay a fixed P dollars (float). No interest-just subtract P each month until the balance is 0 or less.
Ask for B and P (assume P > 0 and B > 0). Print how many months it took. The last payment can overshoot zero (that is OK for this model).
Skills: while on balance, counter.