Program ran fine and checked with different inputs but task is failing verification
package com.codegym.task.task07.task0706;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
/*
Streets and houses
1. Create an array of 15 integers.
2. Populate it with values from the keyboard.
3. Let the array index represent the house number.
The array value at a particular index represents the number of people
living in the corresponding house.
Houses with odd numbers are located on one side of the street.
Those with even numbers are on the other side.
Find out which side of the street has more people living on it.
4. Display the following message: "Odd-numbered houses have more residents." or
"Even-numbered houses have more residents."
Note:
the house at index 0 is considered even.
*/
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Scanner sc = new Scanner(System.in);
int[]lg = new int[15];
int even_count = 0;
int odd_count = 0;
for (int i=0; i<15; i++) {
lg[i] = sc.nextInt();
}
for (int i=0; i<15; i++) {
if(lg[i]%2 == 0) {
even_count++;
}
else
odd_count++;
}
if (even_count > odd_count) {
System.out.println("Even-numbered houses have more residents.");
}
else
System.out.println("Odd-numbered houses have more residents.");
}
}