Posts

Showing posts with the label Write a python program to test whether a number entered by the user is negative orpositive or equal to zero.

Write a python program to test whether a number entered by the user is negative, positive or equal to zero.

Image
                                Write a python program to test whether a number entered by the user is negative, positive or equal to zero. PROGRAM: num=int(input("Enter a number:")) if (num<0):     print(num, " is a negative.") elif (num>0):     print(num, "is a positive.") else:     print(num, "is equal to zero.") OUTPUT: Enter a number: -9 -9 is a negative.