Calculate Simple Interest in C++
Description:
In this post i will give you a simple program to calculate a simple interest value given to the compiler by the operators. This program uses the simple interest calculation formula and also the small practice of cin>> function in the compiler.
Program Structure in Turbo C++ Compiler:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
double p,r,t,i;
cout<<"Enter Principal Amount, Rate, Time:";
cin>>p>>r>>t;
i=(p*r*t)/100;
cout<<"\n Principal Amt = Rs "<<p;
cout<<"\n Rate = "<<r<<"%";
cout<<"\n Time = "<<t<<"yrs";
cout<<"\n Simple Interest rate Amt = Rs "<<i;
getch();
}
#include<conio.h>
void main()
{
clrscr();
double p,r,t,i;
cout<<"Enter Principal Amount, Rate, Time:";
cin>>p>>r>>t;
i=(p*r*t)/100;
cout<<"\n Principal Amt = Rs "<<p;
cout<<"\n Rate = "<<r<<"%";
cout<<"\n Time = "<<t<<"yrs";
cout<<"\n Simple Interest rate Amt = Rs "<<i;
getch();
}
Program Guide:
- Clrscr stand for the Clear Screen option.
- Double the main function with in the program.
- I=(p*r*t)/100 formula to calculate the interest.
Post a Comment