-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab1_Question2.java
More file actions
56 lines (33 loc) · 974 Bytes
/
Lab1_Question2.java
File metadata and controls
56 lines (33 loc) · 974 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package day14_methodsPart2;
public class Lab1_Question2 {
public static void main(String[] args) {
// olcay // Jun 15, 2020
//Question-2
//The number 6 is a truly great number. Write a method that accepts num1 and num2,
//-prints true if either one is 6. Or if their sum or difference is 6.
//love6(6, 4) → true
//love6(4, 5) → false
//love6(1, 5) → true
//love6(12, 6); ->true
love66(6,4);
love66(4,5);
love66(1,5);
love66(6,12);
}
public static void love6(int i, int j) {
if(i==6 || j ==6) {
System.out.println(true);
}else if(i-j==6 || i+j==6) {
System.out.println(true);
}else {
System.out.println(false);
}
}
public static void love66(int num1, int num2) {
if(num1==6 || num2==6 || num1+num2==6 || num1-num2==6) {
System.out.println(true);
}else {
System.out.println(false);
}
}
}