public class Solution {
//main method
public static void main(String[] args) throws Exception {
//declare local variables
int n1=0;
int nNeg=0;
int nPos=0;
int i=0;
//prepare keyboard to input
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while (i<=2){
n1 = Integer.parseInt(br.readLine());
if (n1==0){
break;
}
else if (n1>0){
nPos++;
i++;
}
else {
nNeg++;
i++;
}
}
System.out.println("Number of negative numbers: " + nNeg);
System.out.println("Number of positive numbers: " + nPos);
}
}
package com.codegym.task.task04.task0429;
/*
Positive and negative numbers
*/
import java.io.*;
public class Solution {
//main method
public static void main(String[] args) throws Exception {
//declare local variables
int n1=0;
int nNeg=0;
int nPos=0;
int i=0;
//prepare keyboard to input
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while (i<=2){
n1 = Integer.parseInt(br.readLine());
if (n1==0){
break;
}
else if (n1>0){
nPos++;
i++;
}
else {
nNeg++;
i++;
}
}
System.out.println("Number of negative numbers: " + nNeg);
System.out.println("Number of positive numbers: " + nPos);
}
}