Q) Write a C++ program to find and display simple interest and compound interest.
Source code:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float p,r,t,si,ci;
cout<<"Principle amount-";
cin>>p;
cout<<"Rate of interest-";
cin>>r;
cout<<"Time period-";
cin>>t;
si=(p*r*t)/100;
ci=((p*(1+r)/100)*t)-p;
cout<<"Simple interest="<<si<<endl;
cout<<"Compound interest="<<ci<<endl;
getch();
}
Output:
No comments:
Post a Comment