- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPositiveNegative.java
More file actions
Latest commit
31 lines (21 loc) · 693 Bytes
/
Copy pathPositiveNegative.java
File metadata and controls
31 lines (21 loc) · 693 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
importjava.util.Scanner;
publicclassPositiveNegative {
publicstaticvoidmain(String[] args) {
intnum; //Declaring Variables
System.out.println("Program to check if the entered number (int) is Positive or Negative.\n---");
Scannersm = newScanner(System.in);
System.out.print("Please enter the number: ");
num = sm.nextInt();
sm.close();
if (num>0) {
System.out.println("The number you have entered is Positive.");
}
elseif (num==0) {
System.out.println("The number you have entered is ZERO.");
}
else {
System.out.println("The number you have entered is Negative.");
}
System.out.println("---\nThe Program has ended.");
}
}