Calculate Simple Interest

Beginner-friendly C++ program that reads principal, rate, and time to calculate simple interest and total amount payable.

C++Beginner
C++
#include <iostream>
#include <iomanip>
using namespace std;

int main() {
    float principal, rate, time, interest, totalAmount;
    
    cout << "Enter principal amount: ";
    cin >> principal;
    
    cout << "Enter interest rate (per year): ";
    cin >> rate;
    
    cout << "Enter time period (in years): ";
    cin >> time;
    
    // Calculate simple interest
    interest = (principal * rate * time) / 100.0;
    
    // Calculate total amount
    totalAmount = principal + interest;
    
    cout << fixed << setprecision(2);
    cout << "\nSimple Interest: " << interest << endl;
    cout << "Total Amount: " << totalAmount << endl;
    
    return 0;
}

Output

Enter principal amount: 10000
Enter interest rate (per year): 5
Enter time period (in years): 2

Simple Interest: 1000.00
Total Amount: 11000.00

Calculate Simple Interest in C++

This program calculates simple interest, which is a fundamental concept in finance and banking. Simple interest is calculated using the formula: ## Interest = Principal × Rate × Time / 100.

Understanding Simple Interest

Simple interest is the interest calculated only on the original principal amount. It does not compound (unlike compound interest).

Formula:

  • Simple Interest = (Principal × Rate × Time) / 100
  • Total Amount = Principal + Interest

Key Components

  1. Principal (P): The original amount of money

  2. Rate (R): The interest rate per year (as a percentage)

  3. Time (T): The time period in years

  4. Interest (I): The interest earned

  5. Total Amount: Principal + Interest

Program Flow

  1. Read principal amount from user
  2. Read interest rate from user
  3. Read time period from user
  4. Calculate interest using the formula
  5. Calculate total amount
  6. Display both interest and total amount

Example Calculation

If:

  • Principal = ₹10,000
  • Rate = 5% per year
  • Time = 2 years

Then:

  • Interest = (10000 × 5 × 2) / 100 = ₹1,000
  • Total Amount = 10,000 + 1,000 = ₹11,000

Key Takeaways

1

Simple interest formula: I = (P × R × T) / 100

2

Total amount = Principal + Interest

3

Use float for decimal values (rate, amounts)

4

Format output for readability