# How To Find Compound Interest Using C++ Program

[5391 views]

In this tutorial we will learn How To Find Compound Interest Using C++ Program. Compound Interest refers to the addition of interest to the principal sum of a loan or deposit. In another word the definition 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.

This type of program are often asked in various job interview and programming contest.

## C++ Program to Find Compound Interest

#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