Write a program to calculater Interest rate.

The program calculates the value of money at the end of each year of investment assuming an interest rate of 11 percent and prints the year and the corresponding amount, in two columns.

  1. #include"stdio.h"
  2. #define PERIOD 10
  3. #define PRINCIPAL 5000.00
  4. main()
  5. {
  6. int year;
  7. float amount, value, inrate;
  8. amount = PRINCIPAL;
  9. inrate = 0.11;
  10. year = 0;
  11. while(year <= PERIOD)
  12. {
  13. printf("%2d %8.2f\n", year, amount);
  14. value = amount + inrate * amount;
  15. year = year + 1;
  16. amount = value;
  17. }
  18. }

The output after the execution will be :

0 5000.00
1 5550.00
2 6160.50
3 68.38.15
.
.
.
.
10 14197.11

No comments:

Post a Comment