Don’t miss the chance of Java programs examples with output pdf free download as it is very essential for all beginners to experienced programmers for cracking the interviews.
Java Program to Calculate Simple Interest
- Java program to find the simple interest
In this java program to calculate simple interest, we first take amount, duration in year and rate of interest as input from user and use following equation to calculate simple interest.
Simple Interest = (Principle x Rate x Time) / 100
Java program to calculate simple interest
package com.tcc.java.programs; import java.util.Scanner; /** * Java Program to calculate Simple Interest */ class SimpleInterest { public static void main(String[] args) { double principal, time, rate, SI; Scanner scanner = new Scanner(System.in); // Taking input from user System.out.println("Enter Amount"); principal = scanner.nextDouble(); System.out.println("Enter Duration in Years"); time = scanner.nextDouble(); System.out.println("Enter Rate of Interest"); rate = scanner.nextDouble(); // Calculate Simple Interest SI = (principal * time * rate) / 100; System.out.format("Simple Interest = %f", SI); } }
Output
Enter Amount 10000 Enter Duration in Years 3 Enter Rate of Interest 10 Simple Interest = 3000.000000