How to calculate Simple Interest in Java Programming

Simple Interest is the extra amount which has to be given by the person who bears/takes the loan from banks or others at the fixed rate.

Formula of Simple Interest =(P*R*T)/100
Where P=Principle amount of loan
R=Rate at which interest has to be paid
T=Time under which loan has to be paid.

Java Code for calculating Simple Interest

import java.util.Scanner;
public class SI
{
public static void main(String[] args)
{
Scanner s=new Scanner(System.in);
int p,r,t;
double interest;
System.out.print(“Enter principle amount :”);
p=s.nextInt();
System.out.print(“Enter rate of interest :”);
r=s.nextInt();
System.out.print(“Enter time period :”);
t=s.nextInt();
interest=(p*r*t)/100.0;
System.out.println(“Interest = “+interest);
}
}

Output :

Leave a Reply