Check whether the given number is negative or not.

In this python if else program, we will check whether the given number is negative or not.

Negative number:
A negative number is any number that is less than zero.

Steps to solve the program
  1. Take a number as input through the user.
  2. If the number is negative then print True, else print False.
  3. Use an if-else statement for this purpose.
  4. Print the output.
				
					num = int(input("Enter a number: "))

if num<0:
    print("True")
else:
    print("False")
				
			

Output :

				
					Enter a number: -45
True
				
			

Related Articles

check whether the given number is positive or not.

check whether the given number is positive or negative and even or odd.

Leave a Comment