02/03/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:-










Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me

0 Comments: