forked from BimalRajGyawali/hacktoberfest-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPosiNegaZero.java
29 lines (25 loc) · 853 Bytes
/
PosiNegaZero.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.util.*;
public class PosiNegaZero {
public static void main(String args[]) {
int positive = 0, negative = 0, zeros = 0;
System.out.println("Press 1 to continue & 0 to stop");
Scanner sc = new Scanner(System.in);
int input = sc.nextInt();
while(input == 1) {
System.out.println("Enter your number : ");
int number = sc.nextInt();
if(number > 0) {
positive++;
} else if(number < 0) {
negative++;
} else {
zeros++;
}
System.out.println("Press 1 to continue & 0 to stop");
input = sc.nextInt();
}
System.out.println("Positives : "+ positive);
System.out.println("Negatives : "+ negative);
System.out.println("Zeros : "+ zeros);
}
}