Python Program to check if a Number is Positive, Negative or ZeroHere, we will learn to write a Python program through which we can check if the given number is positive, zero, or negative. Positive Numbers: A number is said to be positive if the number has a value greater than 0, like 1, 2, 3, 5, 7, 9, 11, 13, etc. All the natural numbers are positive numbers. Negative Numbers: If a given number has a value less than 0 like -1, -2, -3, -5, -7, -9, -11, -13, etc., then we can say that the given number is a negative number. Only rational and integer type numbers can have negative values or numbers. Let us look at the following example to understand the implementation Example:Output: Enter a number as input value: -6 Number given by you is Negative Explanation: We have used a nested if else condition in the program to check the number. When the user gives an input number, the program will first check if the value of the number is greater than 0 (if yes, it will print positive and the program ends), otherwise it will check if the value is less than 0 and it last it will print that number is 0. Next TopicPython Number is Odd or Even |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India