Monday, 2 March 2015

C++ Program To Find Compound Interest

Problem:- C++ Program To Find Compound Interest or compound interest program in c or c program for compound interest.

Logic:- According to Wikipedia Compound interest is the addition of interest to the principal sum of a loan or deposit, or in other words, interest on interest. It is the result of reinvesting interest, rather than paying it out, so that interest in the next period is then earned on the principal sum plus previously-accumulated interest. Compound interest is standard in finance and economics.

Compound interest may be contrasted with simple interest, where interest is not added to the principal, so there is no compounding. The simple annual interest rate is the interest amount per period, multiplied by the number of periods per year. The simple annual interest rate is also known as the nominal interest rate.

Compound Interest Formula:-

CI = ( P * (pow((1+r/n),(n*t))) - P);

Where  

P = Principal amount .
r = Rate of nterest ( Annual ).
n = compounding frequency ( Monthly ).
t = time

Example:- We have 10,000 Rs is invested for in company rate of interest is 5%, and compounded monthly and for 15 years what will be the profit in principal amount, Explain with a step by step.

Explanation:-

r = R / 100.

P = 10,000.
r = 5/100 = 0.05.
n = 12.
t = 15.

Now put these value in formula and after calculation remove the principal amount from compound interest so we can get total Compound Interest.

CI = ( 10,000 * (1 + 0.05 / 12 ) ^  ( 12 * 15 ) - 10,000 ).

So here we get final Compound interest earn is = 11137.2 Rs.

Solution:-

#include<iostream>
#include<math.h>
using namespace std;
int main()
{
 //By-Ghanendra Yadav

 float P, r, t, n, R, CI;
  
 cout<<"\n\nEnter The Principal Amount :\n";
 cin>>P;

 cout<<"\n\nEnter Rate of Interest (Annual) :\n";
 cin>>R;

 cout<<"\n\nEnter compounding frequency (Monthly) :\n";
 cin>>n;

 cout<<"\n\nEnter Time (Period) :\n";
 cin>>t;

 r = R / 100;

 CI = ( P * (pow((1+r/n),(n*t))) - P);

 cout<<"\n\nCompound Interest is After "<<t<<" Years is = "<<CI<<endl<<endl;

 return 0;

}

Output:-

compound interest program in c

You May Like This:-










Ghanendra Yadav
Ghanendra Yadav

I Am Ghanendra Yadav Owner Of This Website. I Love Programming, Web Developing, Logo Making, Banner And Website designing. Currently I Am Studying In NIT Warangal And Also Working With WSDC( As Web Application Developer ) In NIT Warangal For Any Query Mail Me I Will Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment