The Code given below can be used in TURBO C++ Compilers: -
#include <iostream.h>
#include <conio.h>
#include <math.h>
void main()
{
float p,r,t,ci,si;
cout<<"Enter Principle (Amount) :: ";
cin>>p;
cout<<"\nEnter Rate of Interest :: ";
cin>>r;
cout<<"\nEnter Time Period :: ";
cin>>t;
si = (p*r*t)/100;
ci = p*pow((1+r/100),t);
cout<<"\nThe Calculated Simple Interest is "<<si<<endl;
cout<<"\nThe Calculated Compound Interest is "<<ci<<endl;
getch();
clrscr();
}
The Code given below can be used in gcc/g++ Compilers: -
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
float p,r,t,ci;
cout<<"Enter Principle (Amount) :: ";
cin>>p;
cout<<"\nEnter Rate of Interest :: ";
cin>>r;
cout<<"\nEnter Time Period :: ";
cin>>t;
ci = p*pow((1+r/100),t);
cout<<"\nThe Calculated Compound Interest is = "<<ci<<"\n";
return 0;
}
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP