C++ Program to calculate Simple Interest. This program calculates the simple interest and prints the result on the compiler screen.
Three values i.e principal amount(p), interest rate(r) & time period(t) are input by the user using 'cin'. All three are taken of 'float' type .
The formula for simple interest is : p*r*t/100.The result is shown on compiler screen using 'cout'.
Source Code:-
#include<iostream.h>
#include<conio.h>
void main()
{float p,r,t,si;
clrscr();
cout<<"Program to calculate Simple Intrest by-Tarun Rawat\n";
cout<<"Enter the amount : ";
cin>>p;
cout<<"Enter the rate of intrest in percent : ";
cin>>r;
cout<<"Enter the time in year : ";
cin>>t;
si=p*r*t/100;
cout<<"\nSimple Interest is : "<<si;
getch();
}
Three values i.e principal amount(p), interest rate(r) & time period(t) are input by the user using 'cin'. All three are taken of 'float' type .
The formula for simple interest is : p*r*t/100.The result is shown on compiler screen using 'cout'.
Source Code:-
#include<iostream.h>
#include<conio.h>
void main()
{float p,r,t,si;
clrscr();
cout<<"Program to calculate Simple Intrest by-Tarun Rawat\n";
cout<<"Enter the amount : ";
cin>>p;
cout<<"Enter the rate of intrest in percent : ";
cin>>r;
cout<<"Enter the time in year : ";
cin>>t;
si=p*r*t/100;
cout<<"\nSimple Interest is : "<<si;
getch();
}
Wow! nice answer
ReplyDelete