-
Notifications
You must be signed in to change notification settings - Fork 0
/
Q_32.java
47 lines (42 loc) · 1.04 KB
/
Q_32.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
package New;
import java.util.Scanner;
public class Q_32 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int num1,num2,num3;
boolean userInputCorrect=false;
Scanner sc=new Scanner(System.in);
do {
System.out.println("Enter the value of three integers");
num1=sc.nextInt();
num2=sc.nextInt();
num3=sc.nextInt();
if(num1>0 && num2>0 && num3>0) {
break;
}
else {
System.out.println("Enter non zero values");
}
}while(!userInputCorrect);
int sum=num1+num2+num3;
System.out.println("Sum="+sum);
System.out.println("Product="+num1*num2*num3);
System.out.println("Average="+sum/3);
if( num1 >= num2 && num1 >= num3)
System.out.println(num1+" is the largest Number");
else if (num2 >= num1 && num2 >= num3)
System.out.println(num2+" is the largest Number");
else
System.out.println(num3+" is the largest Number");
}
}
/*Output
Enter the value of three integers
2
3
4
Sum=9
Product=24
Average=3
4 is the largest Number
*/