Skip to content

Commit b0af4d1

Browse files
committed
feat: Add conditional check for determining if a number is positive or negative
🧠 Logic: - Initializes an integer `n` with a negative value. - Uses an if-else condition to print "Positive" if `n >= 0`, otherwise prints "Negative". Signed-off-by: Somesh diwan <[email protected]>
1 parent e5840ab commit b0af4d1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Section7ConditionalStatements/src/ConditionalStatementsAB1.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ public static void main(String[] args) {
44

55
if(n>=0){
66
System.out.println("Positive");
7-
}
8-
else {
7+
} else {
98
System.out.println("Negative");
109
}
1110
}
12-
}
11+
}

0 commit comments

Comments
 (0)