### Java Program to Calculate Simple Interest

In this tutorial, we will write a java program to calculate compound interest.

# Simple Interest Formula

``````Simple Interest = (P × R × T)/100
``````
• P is the Principal amount.
• R is the rate per annum.
• T is time in years.
For example: Let’s say a man deposit 5000 INR in a bank account at an interest rate of 5% per annum for 5 years, calculate the simple interest at the end of 5 years.
``Simple interest = 5000*5*5/100 = 1250.0 INR``

# Java Program to calculate simple interest

In the following program, we are taking the values of p, r, and t from a user, and then we are calculating the simple interest based on entered values.
```package com.javaguides.java.tutorial;

import java.util.Scanner;

/**
* Java Program to calculate simple interest
*
* @author https://www.sourcecodeexamples.net/
*
*/
public class JavaProgram {
public static void main(String[] args) {

try (Scanner scanner = new Scanner(System.in)) {
float p, r, t, sinterest;
System.out.print("Enter the Principal : ");
p = scanner.nextFloat();
System.out.print("Enter the Rate of interest : ");
r = scanner.nextFloat();
System.out.print("Enter the Time period : ");
t = scanner.nextFloat();
sinterest = (p * r * t) / 100;
System.out.print("Simple Interest is: " + sinterest);
}
}
}```
Output:
``````Enter the Principal : 5000
Enter the Rate of interest : 5
Enter the Time period : 5
Simple Interest is: 1250.0``````