
Loan Payments
Compute a table that shows a monthly payback schedule for a loan. The principle amount of the loan, the
annual interest rate, and the monthly payment amount are to be read as inputs. Calculate the monthly
interest rate as 1/12 of the annual rate. Each month, rst calculate the current interest = the monthly
rate the loan balance. Then add the interest amount to the balance, subtract the payment, and print
this new balance. Continue printing lines for each month until the normal payment would exceed the
loan balance. On that month, the payment amount should be the remaining balance and the new balance
becomes 0. Print a neat loan repayment table following this format:
Payment schedule for $1000 loan
at 0.125 annual interest rate
and monthly payment of $100.00
Month Interest Payment Balance

1 10.42 100.00 910.42
2 9.48 100.00 819.90
... ... ... ...
10 1.66 100.00 60.99
11 0.64 61.63 0.00


Code:
This is what I have so far, but i dont know how to make it into a table.
/*#include <stdio.h>
int main (void)
{
/*float loan_amount, interest_rate, monthly_payment, monthly_amount, interest;
int n, i=1;
printf("\n Payment Schedule for $1000 loan \n"
" at 0.125 annual interest rate \n"
" and monthly payment of $100.00 \n");
/*scanf("%i", &loan_amount);
printf("Enter Interest rate:");
scanf("%f", &interest_rate);
printf("Enter Monthly Payment:");
scanf("%f", &monthly_payment);
printf("Enter number of payments:");
scanf("%d",&n);
while(loan_amount>0 && i<=n)
{
interest = loan_amount*interest_rate/12;
monthly_amount = (loan_amount+interest  monthly_payment);
if(monthly_amount>0)
printf("Balance remaing after %d payment: $ %.2f\n",i, monthly_amount);
loan_amount = monthly_amount;
i++;
}
return 0;
}*/

To make the columns line up smartly, use a fixed width format in printf().
Code:
printf("%3d %.2f %5d\n",9 82.56,199); //3d=fixed field 3 digits wide, .2 only print 2 digits after the decimal %5d, align number to the other side of a 5 digit wide field
There are several of these, check your help file for many more. This is just an example, not your specific answer.
And welcome to the forum rmrjr22! :cool: