Prerequisite : Loops in Python
To check whether a number is positive, negative, odd, even or zero. This problem is solved using if…elif…else and nested if…else statement.
- A number is positive if it is greater than zero. We check this in the expression of if.
- If it is False, the number will either be zero or negative.
- This is also tested in subsequent expression.
- In case of odd and even A number is even if it is perfectly divisible by 2.
- When the number is divided by 2, we use the remainder operator % to compute the remainder.
- If the remainder is not zero, the number is odd.
Input : 10 Output : Positive number 10 is Even
Input : 0 Output : 0 is Even
Output: Positive number 10 is Even
Output: Positive number 20 is Even
- C program to Check Whether a Number is Positive or Negative or Zero
- Python program to count positive and negative numbers in a list
- Python | Rearrange Positive and Negative Elements
- Lambda expression in Python to rearrange positive and negative numbers
- Python | Counting sign change in list containing Positive and Negative Integers
- Program to check whether the given number is Buzz Number or not
- Check if a triangle of positive area is possible with the given angles
- Program to check for Peterson number
- Python program to check whether a number is Prime or not
- Program to check if a number is divisible by sum of its digits
- Python program to print negative numbers in a list
- Python program to print all negative numbers in a range
- Python program to check if number is palindrome (one-liner)
- Python program to print all positive numbers in a range
- Python program to print positive numbers in a list
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.