C++ program to find simple interest

C++ program to find simple interest :

In this C++ example program, we will learn how to find the simple interest. The user will enter the inputs and it will calculate the simple interest and print it out to the user.

To calculate the simple interest, three values are required: principal amount, time, and rate of interest. With these values, we can calculate the simple interest by using the following formula :

(principal amount * time * rate of interest)/100

Our program will take these values as input from the user.

C++ program :

#include <iostream>
using namespace std;

int main()
    float N, P, R;
    float SI;

    cout << "Enter the principal amount : " << endl; cin >> P;

    cout << "Enter the time in years : " << endl; cin >> N;

    cout << "Enter the rate of interest : " << endl; cin >> R;

    SI = (N * P * R) / 100;

    cout << "Simple Interest : " << SI << endl;
    return 0;

C++ program to find simple interest

Explanation :

The commented numbers in the above program denote the step numbers below :

  1. main() is the starting point of a C++ program. It executes at the start.
  2. N, P and R are floating point variables we have created to hold the interest time, principal amount and rate of interest respectively.
  3. Ask the user to enter the principal amount. Read and store it in P.
  4. Ask the user to enter the interest time in years. Read and store it in N.
  5. Ask the user to enter the rate of interest. Read and store it in R.
  6. Calculate the simple interest and store it in the SI variable.
  7. Print out the simple interest or SI to the user.

Sample Output :

Enter the principal amount :
Enter the time in years :
Enter the rate of interest :
Simple Interest : 1440

Similar tutorials :

Where is the color and why codevscolor ?

Long story short, I love paintings and I paint on weekends. We(me and my wife) have one Youtube channel. Below is a video that I did recently. If you love this please do subscribe to support us 😊❤️❤️