**Java Program to Find the Simple Interest **is a simple program to calculate simple interest.

In this tutorial we are going to see the concept of simple interest, what is simple interest, how it is calculate simple interest, simple interest formula and **Simple interest program in java**.

Let’s start with introduction to simple interest

**What is Simple Interest?**

Lets see meaning of Simple interest : Simple interest is the method of finding the interest charges on loan. Simple interest is determined by multiplying interest rate, principal and and number of days.

**Simple Interest formula :**

To find simple interest we use a simple formula

**Simple interest = (rate * principal * no of days)/100**

Where principal is principal amount to be invested

Rate is interest rate in percentage

And no of days is time period for investment.

**Example :-**

Principal = 1200

Rate = 4.6

Time = 2

Simple interest = (1200 * 4.6 * 2)/100

Simple interest = 110.4

**Logic to find simple interest :**

We take a user input principal, rate and time. The using formula we calculate simple interest. And print simple interest.

**Algorithm for Simple interest program in java**

- Start
- Declare variable
- Take input principal, rate and time from user
- Using formula calculate simple interest
- Print simple interest
- Stop

# Java Program to Find the Simple Interest

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import java.util.*; public class Main { public static void main(String[] args) { Scanner X = new Scanner(System.in); double p=0,r=0,t=0,si=0; System.out.print("Enter Principle : "); p = X.nextFloat(); System.out.print("Enter Rate of Interest: "); r = X.nextFloat(); System.out.print("Enter Time in years : "); t = X.nextFloat(); //Formula of simple interest. si = (p*r*t)/100; System.out.print("Simple Interest is :"+si+"\n"); } } |

**Output :**

**Explanation :**

**1. Start**

**2. Write class**

**3. Declare variables**

p => to store principal amount

r => to store rate of interesr

t => to store no of time for investment

si=> to store calculated simple interest

**4. Take a input principal, rate and time from user**

Suppose for **example** :-

p = 1200

r = 4.6

t = 2

**5. Now calculate simple interest by using formula**

**simpleInterest =(float) (p * r * t) / 100**

If we want result in float value then we require to type cast the result to float. We done externally by specifying float after assignment so that after calculating the value is type casted to floating point value and then assigned to simpleInterest.

simpleInterest = ( 1200 * 4.5 * 2) /100

simpleInterest = 110.4

**6. Next print calculated simple interest.**

## Leave a Reply