Sunday, October 5

Simple Interest Calculator

Another Basic program to Calculate the Simple Interest

Source Code : 


// Program Description :
// A Program that calculates the simple interest.

#include<iostream.h>
#include<conio.h>

void main()
{
// cleaning the screen
clrscr();


// declaration of variables
double p;    float r,si; int t;


// the input of values
cout<<"Enter the Principal Amount : ";
cin>>p;
cout<<"Enter the Rate of Interest : ";
cin>>r;
cout<<"Enter the Time : ";
cin>>t;


// calculation of simple                       Principal x Rate x Time
// interest using the formula   SI   =   -----------------------------
//                                                                         100
si=(p*r*t)/100;


// display the interest that is to paid
cout<<endl<<"The Interest to be paid is "<<si;


// waiting for the user to analyse the output
cout<<endl<<endl<<"Press any key to quit...";
getch();

}  //main ends here

Program Flow : 


  • The message for entering the principal amount is displayed.
  • The user enters the principal amount and presses Enter.
  • The message for entering the rate of interest is displayed.
  • The user enters the rate of interest and presses Enter.
  • The message for entering the time period is displayed.
  • The user enters the time period and presses Enter.
  • The program calculates the Simple Interest using the values provided.
  • The Simple Interest is displayed.
  • The program waits for user to Press any key to exit.


Output Screenshots : 



A Screenshot displaying the Simple Interest to be paid on 20000 @ 12% p.a. after 3 years as 7200


No comments:

Post a Comment