-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFiredrill.java
More file actions
31 lines (27 loc) · 959 Bytes
/
Firedrill.java
File metadata and controls
31 lines (27 loc) · 959 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
public class Firedrill{
public static void taskOne(int[] index) {
for (int counter = 0; counter < index.length; counter++) {
System.out.println(index[counter]);
}
}
public static void taskTwo(int[] index) {
for (int counter = 1; counter < index.length; counter+= 2 ) {
if(counter % 2 == 0){
System.out.println(counter);
}
}
}
public static void taskThree(int[] index) {
for (int counter = 0; counter < index.length; counter++) {
if(counter % 2 != 0){
System.out.println(counter);
}
}
}
public static void main(String...args) {
int[] numbers = {1,2,3,4,5,6,7,8,9,10};
taskOne(numbers);
taskTwo(numbers);
taskThree(numbers);
}
}