No products in the cart.

Write a program to print one …

CBSE, JEE, NEET, CUET

CBSE, JEE, NEET, CUET

Question Bank, Mock Tests, Exam Papers

NCERT Solutions, Sample Papers, Notes, Videos

Write a program to print one of the words negative zero or positive according to whether variable X is less than zero zero or greater than zero respectively
  • 1 answers

Gaurav Seth 3 years, 9 months ago

Source Code: Using if...elif...else

num = float(input("Enter a number: "))

if num > 0:

  print("Positive number")

elif num == 0:

  print("Zero")

else:

  print("Negative number")

 

Source Code: Using Nested if

num = float(input("Enter a number: "))

if num >= 0:

  if num == 0:

      print("Zero")

  else:

      print("Positive number")

else:

  print("Negative number")

http://mycbseguide.com/examin8/

Related Questions

What are called tokens
  • 2 answers

myCBSEguide App

myCBSEguide

Trusted by 1 Crore+ Students

Test Generator

Test Generator

Create papers online. It's FREE.

CUET Mock Tests

CUET Mock Tests

75,000+ questions to practice only on myCBSEguide app

Download myCBSEguide App