Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 27 lines (19 sloc) 0.696 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#include <stdio.h>

int main(void)
{
  float yearly_rate, monthly_rate, payment, balance;
  
  printf("Enter amount of loan: ");
  scanf("%f", &balance);
  printf("Enter interest rate: ");
  scanf("%f", &yearly_rate);
  printf("Enter monthly payment: ");
  scanf("%f", &payment);

  monthly_rate = yearly_rate / (12.0 * 100.0);

  balance = balance - payment;
  printf("Balance remaining after first payment: %.2f\n", balance);
  
  balance = balance * (1.0 + monthly_rate) - payment;
  printf("Balance remaining after second payment: %.2f\n", balance);
  
  balance = balance * (1.0 + monthly_rate) - payment;
  printf("Balance remaining after third payment: %.2f\n", balance);
  
  return 0;
}
Something went wrong with that request. Please try again.