JAVA PROGRAM
Write a Java program to enter P, T, R and calculate Simple Interest.
(Hint)
Simple Intereset = P*R*T/100
Static
class SimpleInterest
{
public static void main(String args[])
{
double p=25000.50,r=8.5,t=5;
double sp = p * r * t/100;
System.out.println("The simple interset is :- "+sp);
}
}
Output :-
Dynamic :-
import java.util.*;
class SimpleInterest
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.println("Enter the Principle amount :-");
double principle = in.nextDouble();
System.out.println("Enter the Rate of interest :-");
double rate = in.nextDouble();
System.out.println("Enter the Time period :-");
double time = in.nextDouble();
double sp = principle * rate * time/100;
System.out.println("The simple interset is :- "+sp);
}
}
Output :-