Find Compound Interest Program in C++
Advertisements
C++ Program to Find Compound Interest
Compound Interest is the addition of interest to the principal sum of a loan or deposit. in other word The concept of compound interest is that interest is added back to the principal sum so that interest is earned on that added interest during the next compounding period.
Compound Interest Example in C++
#include<iostream.h> #include<conio.h> #include<math.h> void main() { float p,r,i,t,ci,a; clrscr(); cout<<"Enter Principal Amount : "; cin>>p; cout<<"Enter Interest Rate: "; cin>>r; cout<<"Enter time period in years: "; cin>>t; i=1+(r/100); // ci=pow(i,t); ci=1; for(a=1;a<=t;a++) ci=ci*i; ci=p*ci-p; cout<<"Compound interest is: "<<ci; getch(); }
Output 1
Enter Principal amount: 1000 Enter interest rate: 2 Enter time period in years: 1 Compound interest is : 20.00
Output 2
Enter Principal amount: 1000 Enter interest rate: 2 Enter time period in years: 2 Compound interest is : 40.40
Output 3
Enter Principal amount: 1000 Enter interest rate: 3 Enter time period in years: 4 Compound interest is : 125.51
Google Advertisment