simple interest java program code example
Example: Java program to find simple interest
import java.util.Scanner;
public class SimpleInterestJavaProgram
{
public static void main(String[] args)
{
float principal, rate, time;
Scanner sc = new Scanner(System.in);
System.out.print("Enter principal amount : ");
principal = sc.nextFloat();
System.out.print("Please enter rate annually : ");
rate = sc.nextFloat();
System.out.print("Please enter time(in years) : ");
time = sc.nextFloat();
float simpleInterest;
simpleInterest = (principal * time * rate) / 100;
System.out.println("The Simple Interest is : " + simpleInterest);
sc.close();
}
}