-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNegativePositiveAndZeroValues.java
More file actions
82 lines (52 loc) · 1.11 KB
/
NegativePositiveAndZeroValues.java
File metadata and controls
82 lines (52 loc) · 1.11 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import java.util.Scanner;
public class NegativePositiveAndZeroValues{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("Enter firt number: ");
int num1 = input.nextInt();
System.out.print("Enter second number: ");
int num2 = input.nextInt ();
System.out.print("Enter third number: ");
int num3 = input.nextInt ();
System.out.print("Enter fourth number: ");
int num4 = input.nextInt ();
System.out.print("Enter fifth number: ");
int num5 = input.nextInt ();
int negative = 0;
int positive = 0;
int zero = 0;
if (num1 < 0)
negative++;
if (num1 > 0)
positive++;
if (num1 == 0)
zero++;
if (num2 < 0)
negative++;
if (num2 > 0)
positive++;
if (num2 == 0)
zero++;
if (num3 < 0)
negative++;
if (num3 > 0)
positive++;
if (num3 == 0)
zero++;
if (num4 < 0)
negative++;
if (num4 > 0)
positive++;
if (num4 == 0)
zero++;
if (num5 < 0)
negative++;
if (num5 > 0)
positive++;
if (num5 == 0)
zero++;
System.out.println(negative);
System.out.println(positive);
System.out.println(zero);
}
}