package pl.codegym.task.task07.task0706;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Ulice i domy
*/
public class Solution {
public static void main(String[] args) throws Exception {
//tutaj wpisz swój kod
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int[] tab = new int[15];
for(int i = 0; i < 15; i++){
tab[i] = Integer.parseInt(reader.readLine());
}
int parzyste = 0, nieparzyste = 0;
for(int x : tab){
if(x % 2 == 0 || x == 0){
parzyste += x;
}else{
nieparzyste += x;
}
}
if(parzyste > nieparzyste){
System.out.print("Więcej ludzi mieszka w domach o parzystych numerach.");
}else if(nieparzyste > parzyste){
System.out.print("Więcej ludzi mieszka w domach o nieparzystych numerach.");
}
}
}
What is wrong with my code? The solution seems alright but the exercise was not passed
Nowy
Komentarze
- Popularne
- Nowe
- Najstarsze
Musisz być zalogowany aby dodać komentarz
Na tej stronie nie ma jeszcze komentarzy