-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathLogicalExpressions.java
More file actions
66 lines (53 loc) Β· 1.95 KB
/
Copy pathLogicalExpressions.java
File metadata and controls
66 lines (53 loc) Β· 1.95 KB
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
package day1;
import java.util.Scanner;
public class LogicalExpressions {
/*
Time Complexity: O(1)
*/
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// int a = scanner.nextInt();
// int b = scanner.nextInt();
// Equality Operator
// System.out.println(a == b);
// greater than operator
// System.out.println(a > b);
// greater than equals
// System.out.println(a >= b);
// less than operator
// System.out.println(a < b);
// less than equals operator
// System.out.println(a <= b); // a < b or a == b
// or operator (||)
// System.out.println(false || false); // false
// System.out.println(true || false); // true
// System.out.println(false || true); // true
// System.out.println(true || true); // true
// System.out.println(false || false || false || true); // true
// System.out.println(1 < 2 || 1 == 2); // true
// And operator (&&)
// System.out.println(false && false); // false
// System.out.println(false && true); // false
// System.out.println(true && false); // false
// System.out.println(true && true); // true
// Not operator (!)
// System.out.println(!true);
// System.out.println(!!!!!!!!!!!false);
System.out.println(!(5 > 4));
// 3 * 2 > 4
// 6 > 4
// true
// System.out.println(3 * 2 / 100 * 1 / 100 > 90 * (3 + 2) - (3 / 4));
// 3 * 0 * 1 / 100 > 90 * (3 + 2) - (3 / 4)
// 3 * 0 * 0 > 90 * (3 + 2) - (3 / 4)
// 0 * 0 > 90 * (3 + 2) - (3 / 4)
// 0 > 90 * (3 + 2) - (3 / 4)
// 0 > 90 * (5) - (3 / 4)
// 0 > 90 * 5 - (3 / 4)
// 0 > 90 * 5 - (0)
// 0 > 90 * 5 - 0
// 0 > 450 - 0
// 0 > 450
// false
}
}