-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopercal.java
More file actions
40 lines (32 loc) · 1.11 KB
/
opercal.java
File metadata and controls
40 lines (32 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package operations;
import java.util.Scanner;
public class opercal {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter three integers: ");
int a = input.nextInt();
int b = input.nextInt();
int c = input.nextInt();
int sum = a + b + c;
double avg = sum / 3.0;
int product = a * b * c;
System.out.println("Sum = " + sum);
System.out.println("Product = " + product);
System.out.println("Average = " + avg);
if (a >= b && a >= c) {
System.out.println(a + " is greater");
} else if (b >= a && b >= c) {
System.out.println(b + " is greater");
} else {
System.out.println(c + " is greater");
}
if (a <= b && a <= c) {
System.out.println(a + " is smaller");
} else if (b <= a && b <= c) {
System.out.println(b + " is smaller");
} else {
System.out.println(c + " is smaller");
}
input.close();
}
}