Сабж. Предыдущую задачу решил по такому же принципу без проблем.
package com.javarush.task.task04.task0429;
/*
Положительные и отрицательные числа
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Solution {
public static void main(String[] args) throws Exception {
//напишите тут ваш код
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(reader.readLine());
int b = Integer.parseInt(reader.readLine());
int c = Integer.parseInt(reader.readLine());
int posCount = 0;
int negCount = 0;
if (a > 0) {
posCount++;
}
if (a < 0) {
negCount++;
}
if (b > 0) {
posCount++;
}
if (b < 0) {
negCount++;
}
if (c > 0) {
posCount++;
}
if (c < 0) {
negCount++;
}
System.out.println("Количество отрицательных чисел: " + negCount);
System.out.println("Количество положительных чисел: " + posCount);
}
}