Sarthaks Test
0 votes
96 views
in C Programming by (15 points)
retagged by
Write a python program to check whether the given number is positive.

Please log in or register to answer this question.

1 Answer

0 votes
by (25 points)

Every positive number is greater than 0. We will not be considering 0 since it is neither positive nor negative.

n = int(input("Enter a number: ")) # input will take user input and int will convert it to integer

if n > 0:

    print("Positive")

elif n < 0:

    print("Negative")

else:

    print("0, which is neither negative nor positive.")

Related questions

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...