-
Notifications
You must be signed in to change notification settings - Fork 0
/
Welcome2.java
34 lines (29 loc) · 1.21 KB
/
Welcome2.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
package org.moro.pages;
/**
* Created by eyal on 06/11/2016.
*/
import java.util.Scanner;
public class Welcome2 {
public static void main(String[] args) {
// create Scanner to obtain input from command line
Scanner input = new Scanner(System.in);
int number1; // first number to compare
int number2; // second number to compare
System.out.print("Enter first integer: "); // prompt
number1 = input.nextInt(); // read first number from user
System.out.print("Enter second integer: "); // prompt
number2 = input.nextInt(); // read second number from user
if (number1 == number2)
System.out.printf(number1 + " == " + number2 + "\n");
if (number1 != number2)
System.out.printf("%d != %d%n", number1, number2);
if (number1 < number2)
System.out.printf("%d < %d%n", number1, number2);
if (number1 > number2)
System.out.printf("%d > %d%n", number1, number2);
if (number1 <= number2)
System.out.printf("%d <= %d%n", number1, number2);
if (number1 >= number2)
System.out.printf("%d >= %d%n", number1, number2);
}
}