-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay-03-Java-Q11
More file actions
46 lines (32 loc) · 1.02 KB
/
Copy pathDay-03-Java-Q11
File metadata and controls
46 lines (32 loc) · 1.02 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
/*Guna wants to know how to find whether the given values is positive or Negative.could you please help him to find the num type implements in programming
Input Format
one integer
Constraints
No Constraints
Output Format
if the given num is 5,execute the statement is Positive
if the given num is -5,execute the statement is Negative
if the given num is 0,execute the statement is Zero.
Sample Input 0
7
Sample Output 0
The Given Number 7 is Positive.
Sample Input 1
-7
Sample Output 1
The Given Number -7 is Negative.
Sample Input 2
0
Sample Output 2
The Given Number 0 is Zero.*/
# Answer
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
System.out.println("The Given Number " + num + " is " + (num > 0 ? "Positive." : num < 0 ? "Negative." : "Zero."));
sc.close();
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
}
}