-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComparingStuff.java
More file actions
40 lines (37 loc) · 921 Bytes
/
ComparingStuff.java
File metadata and controls
40 lines (37 loc) · 921 Bytes
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
import java.util.Scanner;
public class ComparingStuff
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
double first, second;
System.out.print( "Give me two numbers. First: " );
first = keyboard.nextDouble();
System.out.print( "Second: " );
second = keyboard.nextDouble();
if ( first < second )
{
System.out.println( first + " is LESS THAN " + second );
}
if ( first > second )
{
System.out.println( first + " is GREATER THAN " + second );
}
if ( first <= second )
{
System.out.println( first + " is LESS THAN or EQUAL TO " + second );
}
if ( first == second )
{
System.out.println( first + " is EQUAL TO " + second );
}
if ( first >= second )
{
System.out.println( first + " is GREATED THAN or EQUAL TO " + second );
}
if ( first != second )
{
System.out.println( first + " is NOT EQUAL TO " + second );
}
}
}