In this tutorial you will learn about the C++ Program to Calculate Simple Interest and its application with practical example.
In this tutorial, we will learn to create a c++ program that will find Simple Interest using c++ programming
Prerequisites
Before starting with this tutorial we assume that you are best aware of the following C programming topics:
- Basic C++ programming.
- Operators.
- Basic input/output.
- Basic mathematics calculation.
- Precedence.
What Is Simple interest ?
Simple interest is the interest amount given by the bank within a year to user or taken by bank or firm from consumer for a particular principal amount of money at some rate of interest. Simple Interest is a method of calculating the interest for a loan/principal amount.
Here:=>
SI = Simple Interest.
P = Principal.
R = Rate of interest (in percentage).
T = Time Interval (in years).
C++ Program to Calculate Simple Interest.
In this program we will print find Simple Interest . We would first declared and initialized the required variables. Next, we would prompt user to input the Principal,Rate and time . Later we will find Simple Interest.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#include<iostream> using namespace std; int main() { float si,p,r,t; // declaring varibales cout<<"enter principal \t"; // taking input cin>>p; cout<<"enter rate \t"; cin>>r; cout<<"enter time in year.\t"; cin>>t; si=(p*r*t)/100; // caluclating si cout<<"Simple Intrest="<<si; // printing si. return 0; } |
Output
In the above program, we have first declared and initialized a set variables required in the program.
- si = For calculating si.
- p= for principal.
- r= for rate of interest.
- t= for time interval in a year.
First of all we declare variables si,p,r and t then by prompting user to give Principal Rate and time . Here in this program we get principal rate and time from user.
After accepting values of principle, rate and time from user , we apply the formula to calculate simple interest is which is si= (principle x rate x time) / 100. and after calculating si we will print the Simple Interest.
Simple Interest is a method used by mostly in Banking and Economic sectors to calculate the interest charges on loans or in saving account by Bank or Economic Sectors.