Java Program to Calculate Simple Interest

Last Updated : 5 Aug, 2026

Simple Interest (SI) is the interest calculated only on the original principal amount for the entire loan or investment period. It is one of the simplest methods of calculating interest and is commonly used for short-term loans, savings, and financial calculations.

  • Requires only Principal, Rate, and Time.
  • Commonly used for short-term loans and basic financial calculations.

Illustration:

Input: P = 10000
R = 5
T = 5

Output: Simple Interest = 2500.0

Formula

Simple Interest (SI) = P×R×T​/ 100

Where:

  • P = Principal amount
  • R = Annual rate of interest (in %)
  • T = Time period
  • SI = Simple Interest

Example: Program to compute simple interest for given principal amount, time and rate of interest.

Java
import java.io.*;

class GFG {
    public static void main(String args[])
    {
        // We can change values here for
        // different inputs
        float P = 1, R = 1, T = 1;

        /* Calculate simple interest */
        float SI = (P * T * R) / 100;
        System.out.println("Simple interest = " + SI);
    }
}

// This code is contributed by Anant Agarwal.

Output
Simple interest = 0.01

Explanation: In this program, the principal amount (P), rate of interest (R), and time (T) are initialized to 1. The simple interest is calculated using the formula (P × R × T) / 100, and the result is stored in the variable SI. Finally, the program prints the calculated simple interest, which is 0.01.

Example: Calculate Simple Interest

Java
import java.io.*;

class GFG {
    public static void main(String args[])
    {
        // We can change values here for
        // different inputs
        float P = 10000, R = 5, T = 5;

        // Calculate simple interest
        float SI = (P * T * R) / 100;
        System.out.println("Simple interest = " + SI);
    }
}
Try It Yourself
redirect icon

Output
Simple interest = 2500.0

Explanation: The program calculates simple interest using the formula (P × R × T) / 100. For a principal of 10000, interest rate of 5%, and time of 5 years, the calculated simple interest is 2500.0.

Comment