Write Java program for the program -
find the simple interest amd final amount to be paid by taking primcipal amoumt, time and rate of interests as input in java
Answers
import java.util.Scanner;
public class Simple_Interest
{
public static void main(String args[])
{
float p, r, t;
Scanner s = new Scanner(System.in);
System.out.print("Enter the Principal : ");
p = s.nextFloat();
System.out.print("Enter the Rate of interest : ");
r = s.nextFloat();
System.out.print("Enter the Time period : ");
t = s.nextFloat();
float si;
si = (r * t * p) / 100;
System.out.print("The Simple Interest is : " + si);
}
}
Output:
$ javac Simple_Interest.java
$ java Simple_Interest
Enter the Principal : 20202
Enter the Rate of interest : 2.5
Enter the Time period : 3
The Simple Interest is : 1515.15
package Brainly_Answers.Program;
import java.util.Scanner;
public class Simple_Interest {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter Principle amount: ");
double p = sc.nextDouble();
// p means Principle amount
System.out.println("Enter Rate of Interest per year: ");
double r = sc.nextDouble();
//r means Rate of Interest per year
System.out.println("Enter Time in years: ");
double t = sc.nextDouble();
//t means Time in years
double si = (p*r*t)/100;
//si means Simple Interest
double fa = p+si;
//fa means Final Amount
System.out.println("Simple Interest on the principle amount: "+si);
System.out.println("Final amount after adding the principle to the S.I.: "+fa);
}
}