Java Program to Calculate simple interest

Formula to calculate simple interest

Java program to calculate simple interest has been shown here. Simple interest is the amount of interest which is calculated based on the initial principal, interest rate and time (in years). It is determined by using following formula:

$SI = {\Large \frac{p * r * t}{100}}$

Here $SI$ represents simple interest. Pricipal amount, annual interest rate and time have been represented by $p$, $r$ and $t$ respectively. As an example, let's assume $p = 1000$, $r = 5$ and $t = 2$ then by using above formula, we get the value of simple interst $SI = 100$.

1. Java Program & output to calculate simple interest

Code has been copied
Java program to compute simple interest

import java.util.Scanner;
public class SimpleInterest{
    public static void main(String args[]){
        float p,r,t,si;
        // is a standard input stream
        // sc is the object
        Scanner sc= new Scanner(;
        //take input of principal, interest rate and time
        System.out.print("Enter principal amount= ");
        System.out.print("Enter interest rate= ");
        System.out.print("Enter time= ");
        //calculate simple interest
        //print result
        System.out.print("Simple interest= "+si);


Enter principal amount= 5000

Enter interest rate= 3.5

Enter time= 5

Simple interest= 875.0