c++ program to find simple and compound interest


#include<iostream>
#include<math.h>
using namespace std; 

int main()
{
 float p,r,t,ci;
 Enter Principle, Rate and Time:";
 cin>>p>>r>>t;
 ci=p*pow((1+r/100),t);
 Compound Interest = "<<ci; 
 return 0;
}

Output

Enter Principle, Rate and Time:
2000
3
4
Compound Interest = 2251.01
 

Explanation

In this program,we have find the compound interest using the formula and also used pow function to calculate the power value.