-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBranching.java
More file actions
28 lines (24 loc) · 770 Bytes
/
Branching.java
File metadata and controls
28 lines (24 loc) · 770 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
//importing Scanner
import java.util.Scanner;
class Branching {
public static void main(String[] args) {
//instances..
int number;
//creating Scanner object..
Scanner input = new Scanner(System.in);
//Taking input from user..
System.out.print("Enter a Number: ");
number = input.nextInt();
//we have put a if statement to check the number is either positive, negative or zero..
if (number < 0) {
//if the number is less than zero..
System.out.println("The Number is Negative..");
} else if (number > 0) {
//if the number is greater thsn zero..
System.out.println("The Number is Positive..");
} else {
//if the number is equal to zero..
System.out.println("It is Zero..");
}
}
}