Free Data Structures and Algorithms Course









Subscribe below and get all best seller courses for free !!!










OR



Subscribe to all free courses

How to calculate Simple Interest in Java ?.

Program to calculate Simple Interest in Java

import java.util.Scanner;

public class SimpleInterest {

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

    double principal = 0;
    double rate = 0;
    double time = 0;

    double simpleInterest = 0;
  
    System.out.print("Enter the Principal amount : "); 
    principal = input.nextDouble();

    System.out.print("Enter the Rate : "); 
    rate = input.nextDouble();

    System.out.print("Enter the Time : "); 
    time = input.nextDouble();

    simpleInterest = (principal * rate * time) / 100;
    
    System.out.println("");
    System.out.println("The Simple Interest is : "
                        + simpleInterest);
  
  }

}


Output of the program :

















Watch the above Java tutorial on Youtube video :

 
 
© 2021 Learn Java by Examples Template by Hubberspot