Miscellaneous

Java Program to Calculate Simple Interest

A Java program to calculate Simple Interest.

Problem Description

Write a Java program to calculate Simple Interest.

Code

SimpleInterest.java
public class SimpleInterest {
    public static void main(String[] args) {
        float p, r, t, si;
        p = 13000;
        r = 12;
        t = 2;
        si = (p * r * t) / 100;
        System.out.println("Simple Interest is: " + si);
    }
}

Output

Simple Interest is: 3120.0

Explanation

  1. Formula: (P * R * T) / 100.