#include /* loan_calc.c * By Cory Spitzer * Feb. 20th, 2013 * Exersize from K. N. King, page 35 */ int main(void) { float balance, new_balance, rate, monthly_rate, payment; //payment is monthly, rate annual printf("loan_calc.c \n"); printf("What is the loan amount? "); scanf("%f", &balance); printf("What is the annual interest rate? "); scanf("%f", &rate); printf("What is the monthly payment? "); scanf("%f", &payment); monthly_rate = (rate / 12.0f); printf("Your monthly rate is %.4f \n", monthly_rate); // This whole process can certainly be done with a loop, // but this works for now. new_balance = balance - payment; balance = (new_balance) + (monthly_rate * new_balance); printf("Balance remaining after first payment: %.2f \n", balance); new_balance = balance - payment; balance = (new_balance) + (monthly_rate * new_balance); printf("Balance remaining after second payment: %.2f \n", balance); new_balance = balance - payment; balance = (new_balance) + (monthly_rate * new_balance); printf("Balance remaining after third payment: %.2f \n", balance); return 0; }