I thought the reason was because the code wasn't accounting for the 0 so I added || arr[i] == 0 to the code. Apparently that was not the problem. I've been trying to understand why but I don't see what I should change or add. Please, just explain the problem to me.
package com.codegym.task.task07.task0706;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Streets and houses
*/
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
int arr [] = new int [15];
BufferedReader l = new BufferedReader(new InputStreamReader(System.in));
int oc = 0;
int ec = 0;
for (int i = 0; i < arr.length; i++) {
int n = Integer.parseInt(l.readLine());
arr[i] = n;
if (arr[i]%2 == 0 || arr[i] == 0) {
ec++;
} else if (arr[i]%2 != 0) {
oc++;
}
}
if (oc > ec) {
System.out.println("Odd-numbered houses have more residents.");
} else {
System.out.println("Even-numbered houses have more residents.");
}
}
}