Java Program to Calculate Simple Interest - The Coding Shala

Home >> Java Programs >> Calculate Simple Interest

 In this post, we will learn how to Calculate Simple Interests in Java.

Java Program to Calculate Simple Interest

You have given the principal amount, rate of interest, and time. Write a Java Program to calculate the interest amount.

We will use the formula of simple Interest.

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

Here, P = Principle Amount
          R = Rate of Interest
          T = Time

Java Program: 

// Java program to Calculate Simple Interest

public class Main {
	
	public static void main(String[] args) { 
		
		float P = 2000;
		float R = 6;
		float T = 3;
		
		// calculate interest using formula
		float interest = (P * R * T) / 100;
		
		// print 
		System.out.println("Principal amount is: " + P);
		System.out.println("Interest Rate is: " + R);
		System.out.println("Time is: " + T);
		System.out.println("Total Interest is: " + interest);
	}
}

Output: 

Principal amount is: 2000.0
Interest Rate is: 6.0
Time is: 3.0
Total Interest is: 360.0


Other Posts You May Like
Please leave a comment below if you like this post or found some errors, it will help me to improve my content.

Comments

Popular Posts from this Blog

Shell Script to find sum, product and average of given numbers - The Coding Shala

New Year Chaos Solution - The Coding Shala

Java Method Overloading - The Coding Shala

Shell Script to Create a Simple Calculator - The Coding Shala

Maximum Width Ramp LeetCode Solution - The Coding Shala