C++ Program to calculate Simple Interest

In this post, we will be learning how to write a C++ Program to Calculate Simple Interest of the given values of Principle, Time and Rate.

The formula to Calculate Simple Interest

To calculate S.I, we have a formula:-

S.I = (P*R*T)/100
Where,
S.I represents Simple Interest,
P represents Principle,
R represents Rate (annually),
T represents Time (in years).

Code:-

#include <iostream>

using namespace std;

int main()
{
    float p;
    float r;
    float t;
    // Taking an input for principle
    cout << "Enter the principle: ";
    cin >> p;
    // Taking an input for rate per year
    cout << "Enter the rate: ";
    cin >> r;
    // Taking an input for time
    cout << "Enter the time(In Year): ";
    cin >> t;
    // formula for S.I. is (p*r*t)/100
    float si = (p*r*t)/100;
    
    // printing the simple interest
    cout << "The Simple Interest is "  << si << endl;

    return 0;
}

Output:-

Enter the principle: 500 Enter the rate: 5 Enter the time(In Year): 3 The Simple Interest is 75

That was all about this program. If you find any problem you can comment below.

You can learn about many other C++ Programs Here.







The following two tabs change content below.
Amit Rawat

Amit Rawat

Founder and Developer at SpiderLabWeb
I love to work on new projects and also work on my ideas. My main field of interest is Web Development.

You may also like...