Java Program To Calculate Simple Interest
Chapter:
Interview Programs
Last Updated:
22-06-2016 18:18:41 UTC
Program:
/* ............... START ............... */
import java.util.*;
public class JavaSimpleInterestExample {
public static void main(String []args)
{
double p=0,r=0,t=0,si=0;
//Scanner class to take user input.
Scanner value = new Scanner(System.in);
System.out.print("Enter Principle : ");
p = value.nextFloat();
System.out.print("Enter Rate of Interest: ");
r = value.nextFloat();
System.out.print("Enter Time in years : ");
t = value.nextFloat();
//Formula of simple interest.
si = (p*r*t)/100;
System.out.print("Simple Interest is :"+si+"\n");
}
}
/* ............... END ............... */
Output
Enter Principle : 100000
Enter Rate of Interest: 10
Enter Time in years : 5
Simple Interest is :50000.0
Tags
Calculate Simple Interest, Java, Interview Programs