-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfun_one.java
More file actions
33 lines (25 loc) · 888 Bytes
/
fun_one.java
File metadata and controls
33 lines (25 loc) · 888 Bytes
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
30
31
32
33
import java.util.*;
public class fun_one{
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);
}
}