C++ Program To Calculate Simple Interest

What we are going to see through this article is we will see in detail C++ Program To Calculate Simple Interest. Simple Interest is the conventional method used in banking and economic sectors to calculate the interest charges on loans. It gets estimated day today with the help of some mathematical terms.

After taking input (Principle, Rate, Time) from the user we have to use a very simple formula shown below:

Simple interest formula

Where, P = Principle, T = Time and R = Rate

To calculate simple interest we have to multiply principal, rate, and time, then divide it by 100 and print the result.

C++ Program To Calculate Simple Interest

C++ Program to Calculate Simple Interest

#include<iostream>
using namespace std;

// function declaration
double calculateInterest(double p, double t, double r);

// main function
int main()
{
  // declare variables
  double p, t, r, interest;

  // take input from end-user
  cout << "Enter principal amount, time and rate:";
  cin >> p >> t >> r;

  // calculate interest
  interest = calculateInterest(p, t, r);

  // display result
  cout << "Interest = " << interest << endl;

  return 0;
}

// function to calculate interest value
double calculateInterest(double p, double t, double r)
{
    return (p*t*r)/100;
}

Output

Here the inputs are principal amount = 10000, interest rate =5, time =9.9. If we can manually substitute the value in the simple interest formula we can get the same output mentioned below. Hence the output is verified.

Enter principal amount, time and rate:10000 5 9.9
Interest = 4950

Read Also: C++ Program To Calculate Compound Interest

Final Words

What we learned through this article is to C++ Program To Calculate Simple Interest. Also if you have any doubts please leave a comment via the comment box. And we ask that you benefit everyone who shared this article with your friends.

Leave a Comment