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

0 comments:

Post a Comment

 

About Me

It's Me!Hi, I'm Moinuddin. I'm a Software Engineer at WIPRO working on Microsoft .NET Technology. I'm interested in a wide range of technology topics, mainly Microsoft including Windows Azure, WCF, WPF, Silverlight and any other cool technology that catches the eye.

Site Info

ProjectCSharp.com is mainly about demonstrating real time examples in different technologies like ASP.NET, WCF, WPF, Silverlight, Azure etc..,

Followers

Help Links

Project CSharp (C#) Copyright © 2011. All Rights Reserved.