-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathE32.java
46 lines (34 loc) · 1.02 KB
/
E32.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
/*
* 32. Write a Java program to compare two numbers.
Input Data:
Input first integer: 25
Input second integer: 39
Expected Output
25 != 39
25 < 39
25 <= 39
*/
package w3resourceExcersises;
import java.util.Scanner;
public class E32 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
System.out.println("Input first integer...");
int int1 = sc.nextInt();
System.out.println("Input 2nd integer...");
int int2 = sc.nextInt();
if (int1 == int2) {
System.out.println(int1 +" = " + int2);
}
else if (int1 > int2){
System.out.println(int1 + " != " + int2);
System.out.println(int1 + " > " + int2);
}
else if (int1 < int2) {
System.out.println(int1 + " != " + int2);
System.out.println(int1 + " < " + int2);
};
sc.close();
}
}