Java Program to Calculate Simple Interest - The Coding Shala
Home >> Java Programs >> Calculate Simple Interest
Other Posts You May Like
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
- Java Program to Find the Area of Triangle
- Java Program to Find the Area of Circle
- Java Program to Find the Area of Rectangle
- Java Program to Calculate the Power of a Number
- Java Program to Calculate the Power of a Number using Recursion
Comments
Post a Comment