Simple Interest

Calculate simple interest given principal, rate, and time.

JavaBeginner
Java
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        System.out.print("Enter principal: ");
        double p = sc.nextDouble();
        System.out.print("Enter rate of interest: ");
        double r = sc.nextDouble();
        System.out.print("Enter time (in years): ");
        double t = sc.nextDouble();

        double si = (p * r * t) / 100.0;
        System.out.println("Simple Interest = " + si);

        sc.close();
    }
}

Output

Enter principal: 1000
Enter rate of interest: 5
Enter time (in years): 2
Simple Interest = 100.0

Simple interest formula: SI = (P × R × T) / 100.