-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday 10
More file actions
23 lines (19 loc) · 774 Bytes
/
day 10
File metadata and controls
23 lines (19 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//Write program in java that input by the user take principla , rate , time then calculate their si and average with suitable message
import java.util.Scanner;
class uilof77
{
void display()
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter principal amount: ");
double principal = sc.nextDouble();
System.out.print("Enter rate of interest: ");
double rate = sc.nextDouble();
System.out.print("Enter time (in years): ");
double time = sc.nextDouble();
double simpleInterest = (principal * rate * time) / 100;
double average = simpleInterest / time;
System.out.println("Simple Interest: " + simpleInterest);
System.out.println("Average Simple Interest per year: " + average);
}
}