Write a C++ program to calculate the simple interest. It inputs principal amount, rate of interest and the numbers of years and displays the simple interest.


#include<iostream>

using namespace std;

int main()

{

double p,r,t,i;

cout<<"Enter principal amount, rate, time: ";

cin>> p >>r>>t>>i;

i = (p * r * t)/100;

cout<<"\n Principal Amt = Rs. "<<p;

cout<<"\n Rate = " <<r<<"%";

cout<<"\n Time = " <<t<<"yrs";

cout<<"\n Simple Interst Amt = Rs. "<<i;


}

OUTPUT

Enter principal amount, rate, time: 1000 5 3

 Principal Amt = Rs. 1000

 Rate = 5%

 Time = 3yrs

No comments:

Post a Comment