Author Topic: Turbo C Program to Calculate Compound Interest  (Read 1370 times)

kathir

  • Administrator
  • Sr. Member
  • *****
  • Posts: 283
Turbo C Program to Calculate Compound Interest
« on: December 29, 2011, 01:17:23 pm »
Here is the Turbo C Program to Calculate Compound Interest.

The formula for calculating  Compound Interest is given below:

FV   =   P * (1  +  r / n)Y*n

where

FV - Future Value
P - Present Value (principal amount)
r - Interest rate
n - number of times the interest is calculated per year
Y - number of years


Code:
//Source Code Listing

#include <stdio.h>
#include <math.h>

void main()
{
   double amount;
   double years;
   double interest_rate;
   double numtimes;
   double compound_interest;
   
   printf("Program to Calculate Compound Interest");
   
   printf("Enter Principal Amount:");
   scanf("%lf",&amount);

   printf("Enter Number of Years:");
   scanf("%lf",&years);

   printf("Enter Interest Rate:");
   scanf("%lf",&interest_rate);

   printf("Enter the number of times the interest is compounded per year: ");
   scanf("%lf",&numtimes);
 
   compound_interest = amount * pow( (1 + (interest_rate / 100) / numtimes ), numtimes * years);
   printf("Future Value after Compound Interest = %lf\n",compound_interest);
}

/***
Sample Output:

Program to Calculate Compound InterestEnter Principal Amount :1000
Enter Number of Years:5
Enter Interest Rate:5
Enter the number of times the interest is compounded per year: 2
Future Value after Compound Interest = 1280.084544



***/
« Last Edit: December 29, 2011, 01:31:10 pm by kathir »

 


Disclaimer: This web site is for educational and informational purposes only. Click here to read the Disclaimer.
Content copyright 2010-2014. Kathiresan. All rights reserved.
This page is using SMF version 2.0.1