Monday, 5 January 2015

Java Program to calculate Simple Interest


This is a Cpp program which  calculates the Simple Interest based on the formula

SI = (Principle Amount * Time Period * Rate Of Interest) / 100

PROGRAM :
package codingcorner.in;

import java.util.Scanner;

public class SimpleInterest {
 public static void main(String[] args) {
  float SI, p, t, r;
  Scanner scan = new Scanner(System.in);
  System.out.println("Enter Principle Amount: \t");
  p = scan.nextInt();
  System.out.println("Enter Time Period: \t\t");
  t = scan.nextInt();
  System.out.println("Enter Rate Of Interest: \t");
  r = scan.nextInt();
  scan.close();
  SI = (p * t * r) / 100;

  System.out.println("Simple Interest is " + SI);
 }
}


OUTPUT :