10 PRINT "REMAINING BALANCE ON A LOAN"
20 PRINT
29 REM - STATEMENTS 30 TO 130 REQUEST USER INPUT
30 PRINT "REGULAR PAYMENT";
40 INPUT R
50 PRINT "PRINCIPAL";
60 INPUT P
70 PRINT "NUMBER OF PAYMENTS PER YEAR";
80 INPUT N
90 PRINT "ANNUAL INTEREST RATE";
100 INPUT I
109 REM - CONVERT FROM PERCENT TO DECIMAL
110 I=I/100
119 REM - ENTER THE PAYMENT NUMBER WITHIN THE YEAR, I.E. N1<=N
120 PRINT "LAST PAYMENT MADE (PAYMENT NO. ,YEAR, I.E. 10,4)";
130 INPUT N1,Y
139 REM - INITIALIZE REMAINING BALANCE
140 B0=P
149 REM - LOOP TO ACCUMULATE AMOUNT PAID SO FAR
150 FOR J1=1 TO N*(Y-1)+N1
159 REM - CALCULATE INTEREST PAID WITH EACH PAYMENT
160 I1=INT((B0*I/N)*100+.5)/100
169 REM - CALCULATE AMOUNT AMORTIZED WITH EACH PAYMENT
170 A=R-I1
179 REM - CALCULATE REMAINING BALANCE ON PRINCIPAL
180 B0=B0-A
190 NEXT J1
199 REM - ROUND OFF, PRINT
200 PRINT "REMAINING BALANCE = $";INT(B0*100+.5)/100
210 PRINT
219 REM - RESTART OR END PROGRAM?
220 PRINT "MORE DATA? (1=YES,0=NO)";
230 INPUT X
240 IF X=1 THEN 20
250 END
