Skip to content
Home » Python program to check whether a given number is positive or negative

Python program to check whether a given number is positive or negative

Below is the code to check whether the given number is positive or negative

# to check whether a given number is positive or negative
a=int(input("Enter a number:"))
if a==0:
print("Given number is neither negative nor positive")
elif a<0:
print("The number is negative")
else:
print("The number is positive")

Output:

Enter a number:-7
The number is negative