Help with problem - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Help with problem

illectronicillectronic Posts: 2Member
I need to write a program to calculate the minimum payment per month for an initial balance. The balance accrues interest each month at a set rate. The first month should not have any interest. The minimum payment needs to be in increments of 10. I got this so far, but the answer is coming up over by 10. I got 370 and it should be 360. Any help will be appreciated.

[code]
month = 1
balance = 3926
annualInterestRate = 0.2
payment = 0

while balance >= 0:
remainingBalance = balance - payment
while month < 12:
monthlyInterest = (annualInterestRate) / 12
remainingBalance = (remainingBalance - payment) * (1 + monthlyInterest)
month +=1
if month == 12:
payment += 10
if remainingBalance <= 0:
break
month = 1

print "Lowest Payment: " + str(payment)[/code]
Sign In or Register to comment.