-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay4.java
More file actions
50 lines (33 loc) · 791 Bytes
/
Day4.java
File metadata and controls
50 lines (33 loc) · 791 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
Day 4 coding Statement: Write a program to identify of the a number is positive or negative
Description
Get an input number from the user and check whether it is a positive or negative number.
Input :
-10
Output :
Negative number
Input :
0
Output :
Neither positive nor negative
Input :
15
Output :
Positive number
*/
import java.util.*;
class Day4 {
public static void main(String[] args) {
int n;
Scanner sc=new Scanner(System.in);
System.out.println("Enter a number : ");
n=sc.nextInt();
if(n==0){
System.out.println("Neither positive nor negative");
}else if(n>0){
System.out.println("Positive Number");
}else{
System.out.println("Negative Number");
}
}
}