[1,2,3,4].forEach((num) => num % 2 === 0 && console.log(num));
public int[] findEvens() {
int numberEvens = 0;
for (int i = 0; i < numbers.length; i++) {
if (numbers[i] % 2 == 0) {
numberEvens++;
}
}
public int[] findEvens() {
int numberEvens = 0;
for (int i = 0; i < numbers.length; i++) {
if (i % 2 == 0) {
numberEvens++;
}
}
public static void main(String[] args) {
int[] xr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
for (int i = 0; i < xr.length; i++) {
System.out.println(xr[i] % 2 == 0 ? xr[i] + " -> even" : xr[i] + " -> odd");
}
}