 ## Java Program to Calculate Simple Interest with Example

In this tutorial, we will write a Java program that will calculate simple interest.

Simple Interest Formula

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

• P is Principal amount.
• R is rate per annum.
• T is time in years.

For example, suppose a man deposits 2000 INR in a bank account at a 6% annual interest rate for three years. Calculate the simple interest at the end of three years.

Simple interest = 2000*6*3/100 = 360 INR

Example:

In the following example, we take the user’s p, r, and t values and then calculate simple interest based on those values.

```public class JavaExample
{
public static void main(String args[])
{
float p, r, t, sinterest;
Scanner scan = new Scanner(System.in);
System.out.print("Enter the Principal : ");
p = scan.nextFloat();
System.out.print("Enter the Rate of interest : ");
r = scan.nextFloat();
System.out.print("Enter the Time period : ");
t = scan.nextFloat();
scan.close();
sinterest = (p * r * t) / 100;
System.out.print("Simple Interest is: " +sinterest);
}
}```

Output:

Simple Interest with Example Simple Interest with Example Simple Interest with ExamplevSimple Interest with ExampleSimple Interest with Example Simple Interest with Example v Simple Interest with Example

Enter the Principal : 2000
Enter the Rate of interest : 6
Enter the Time period : 3
Simple Interest is: 360.0