An automobile financier claims to be lending money at simple interest where the Principle and Year are the input and Rate of Interest is 12%. Write a C++ program to calculate it using default arguments.
#include <iostream>
using namespace std;
//The start point of the program
int main (){
float principle;
int year;
//the Principle and Year are the input and Rate of Interest is 12%.
//get the Principle from the user
float rateInterest=0.12;
cout<<"Enter principle: ";
cin>>principle;
cout<<"Enter the number of year: ";
cin>>year;
//Calculate simple interest
float simpleInterest=principle*rateInterest*year;
cout<<"\nSimple interest: "<<simpleInterest<<"\n";
//delay
system("pause");
return 0;
}
Comments
Leave a comment