Advertisement
rafikamal

Calculate Interest

Jan 11th, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int principal, rate, year, i;
  6.     double amount;
  7.  
  8.     printf("Enter principal amount: ");
  9.     scanf("%d", &principal);
  10.     printf("Enter rate of interest: ");
  11.     scanf("%d", &rate);
  12.     printf("Enter number of years: ");
  13.     scanf("%d", &year);
  14.  
  15.     printf("\nYear\tAmount\n\n");
  16.  
  17.     amount = principal;
  18.  
  19.     for(i = 1; i <= year; i++)
  20.     {
  21.         amount += principal * rate / 100.0;
  22.         printf("%d\t%lf\n", i, amount);
  23.     }
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement