Write a program to calculate simple interest and compound interest in c++
Answers
Answered by
11
Answer:
#include <iostream.h>
#include <math.h>
int main()
{
int p;
float r;
int t;
cout<<"Enter principal amount: ";
cin>>p;
cout<<"Enter rate of interest: ";
cin>>r;
cout<<"Enter time period (in years): ";
cin>>t;
float si = p*r*t;
cout<<"Simple interest is: Rs."<<si<<endl;
float total = p * pow((1+r/12), (12*t));
float ci = total - p;
cout<<"Compound interest is: Rs. "<<ci<<endl;
return 0;
}
Explanation:
hope it's help you!!
thank you!!
Similar questions