Computer Applications
Write a Java program to obtain principal amount, rate of interest and time from user and compute simple interest.
Java
Java Operators
20 Likes
Answer
import java.util.Scanner;
public class KboatSimpleInterest
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter principal: ");
double p = in.nextDouble();
System.out.print("Enter rate: ");
double r = in.nextDouble();
System.out.print("Enter time: ");
int t = in.nextInt();
double si = p * r * t / 100;
System.out.println("Simple Interest: " + si);
}
}
Output

Answered By
9 Likes
Related Questions
Write the Java expression for the following:
Evaluate the following expression if the value of x=2, y=3 and z=1. v=x + --z + y++ + y
If
x = 5
andy = 4
, what will be the output of the following code?x += ++y - x-- + y++; System.out.println("x = " + x); System.out.println("y = " + y);
if (a>b&&b>c) then largest number is:
- b
- c
- a
- wrong expression