← all problems

weeksToPayOff 🌶️

You owe balance dollars on a loan and pay weekly dollars each week (a positive whole number). The last payment may be smaller than the others if that is all that is left. Write a method weeksToPayOff that returns how many weeks it takes to pay off the loan. A balance of 0 takes 0 weeks.

For example, weeksToPayOff(100, 25) is 4, and weeksToPayOff(100, 30) is 4 (three payments of 30 leave 10 to pay).