-
Notifications
You must be signed in to change notification settings - Fork 1
/
Small.java
69 lines (33 loc) · 1.11 KB
/
Small.java
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package ChapterTwo;
import java.util.Scanner;
public class Small {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int largest;
int smallest;
System.out.print("Enter a number");
int a=input.nextInt();
System.out.print("Enter second number");
int b=input.nextInt();
System.out.print("Enter third number");
int c =input.nextInt();
int sum = a+b+c;
int product=a*b*c;
int average = a+b+c/3;
smallest =
largest = a;
if(b > largest)
largest = b;
if(c > largest)
largest = c;
if(b < smallest)
smallest = b;
if (c < smallest)
smallest = c;
System.out.printf("The sum is %d%n " , sum);
System.out.printf("The average is %d%n " , average);
System.out.printf("The product is %d%n " , product);
System.out.printf("Largest of three integers is %d%n " , largest);
System.out.printf("Smallest of three integers is %d%n " , smallest);
}
}