Write a java program to calculate simple interest .
please answer this question
Answers
Answer:
import java.util.Scanner;
public class JavaExample
{
public static void main(String args[])
{
float p, r, t, sinterest;
Scanner scan = new Scanner(System.in);
System.out.print("Enter the Principal : ");
p = scan.nextFloat();
System.out.print("Enter the Rate of interest : ");
r = scan.nextFloat();
System.out.print("Enter the Time period : ");
t = scan.nextFloat();
scan.close();
sinterest = (p * r * t) / 100;
System.out.print("Simple Interest is: " +sinterest);
}
}
Explanation:
Output:
Enter the Principal : 2000
Enter the Rate of interest : 6
Enter the Time period : 3
Simple Interest is: 360.0
HOPE IT HELPS YOU
Answer:
1. public class Main.
2. {
3. public static void main (String args[])
4. { float p, r, t, si; // principal amount, rate, time and simple interest respectively.
5. p = 13000; r = 12; t = 2;
6. si = (p*r*t)/100;
7. System.out.println("Simple Interest is: " +si);
8. }}