Java program to calculate Simple Interest

Basic Java programming exercises

Java Tutorial Java Exercises Data Structures

Write a Java program to input principle, time and rate (P, T, R) from user and find Simple Interest. How to calculate simple interest in Java programming. Logic to find simple interest in Java program.

Required knowledge

Variables and expressions,Arithmetic operators,Basic input/output,Data types

Simple Interest formula

Simple interest formula is given by.

java,simple interest,java program,c program to calculate simple interest,java program to calculate simple interest using methods,how to calculate simple interest in c++,java (programming language),java programming,how to program in java,javascript program to find simple interest,c program to find simple interest,how to calculate interest in java,how to create a program of simple interest


P is the principle amount

T is the time and

R is the rate

Logic to calculate simple interest

Step by step descriptive logic to calculate simple interest.

  1. Input principle amount in some variable say principle.

  2. Input time in some variable say time.

  3. Input rate in some variable say rate.

  4. Find simple interest using formula SI = (principle * time * rate) / 100.

  5. Finally, print the resultant value of SI.

Program to calculate simple interest
/** * Java program to calculate simple interest */ import java.util.Scanner; class Test { public static void main(String args[]) { float principle, time, rate, SI; Scanner op=new Scanner(; /* Input principle, rate and time */ System.out.print("Enter principle (amount): "); principle=op.nextFloat(); System.out.print("Enter time: "); time=op.nextFloat(); System.out.print("Enter rate: "); rate=op.nextFloat(); /* Calculate simple interest */ SI = (principle * time * rate) / 100; /* Print the resultant value of SI */ System.out.println("Simple Interest = "+SI); } }


Enter principle (amount): 5700 Enter time: 8 Enter rate: 2 Simple Interest = 912.0