-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday1.java
More file actions
29 lines (25 loc) · 692 Bytes
/
Copy pathday1.java
File metadata and controls
29 lines (25 loc) · 692 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
public class day1 {
public static void main(String[] args) {
int target = 20;
int count = 0;
for(int i = 0; i < target; i++){
if (i % 5 == 0 || i%7 == 0) {
count += i;
}
}
System.out.println(count);
int[] intArray = new int[]{1,2,2,4};
int i;
int j;
boolean flag = false;
for(i = 0; i < intArray.length; i++){
for(j = i+1; j < intArray.length; j++){
if (intArray[i] == intArray[j]){
flag = true;
break;
}
}
}
System.out.println(flag);
}
}