In this tutorial learn how you can find simple interest in java. The formula to find simple interest is (P * T * R)/100. So we use Scanner to get data from user and simply use this formula.
Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.
Here is the code to find simple interest in Java programming.
//Write a java program that finds simple interest. Formula= (p * t * r) / 100 import java.util.Scanner; public class SimpleInterest { public static void main(String[] args) { int P, T, R, I; // Principal,Time,Rate,Interest Scanner data = new Scanner(System.in); System.out.println("Enter Principal, P:"); P = data.nextInt(); System.out.println("Enter Time, T:"); T = data.nextInt(); System.out.println("Enter Rate, R:"); R = data.nextInt(); I = (P*T*R)/100; System.out.println("The simple interest of " + P + " is: " + I ); data.close(); } }
This is how you can find simple interest in java programming. Comment below if you like our tutorial.