Following Python practical will check whether entered number is positive or negative or zero. This program uses the concept of Python's nested if statement.
# Program will check whether entered number is positive or negative or zero.
number = int(input("Enter a number: "))
if number >= 0:
if number == 0:
print("It's Zero")
else:
print("It's Positive number")
else:
print("It's Negative number")
Output of program
Enter a number: 5
It's Positive number
No comments:
Post a Comment