- Related Questions & Answers
- Check if count of divisors is even or odd in Python
- How to determine if a number is odd or even in JavaScript?
- C++ Program to Check Whether Number is Even or Odd
- Check whether given floating point number is even or odd in Python
- PHP program to check if the total number of divisors of a number is even or odd
- Program to check if a number is Positive, Negative, Odd, Even, Zero?
- Python Program for Check if the count of divisors is even or odd
- Java Program to check if count of divisors is even or odd
- C Program to Check if count of divisors is even or odd?
- C# Program to check if a number is Positive, Negative, Odd, Even, Zero
- 8085 program to check whether the given number is even or odd
- Python Program to Determine Whether a Given Number is Even or Odd Recursively
- How to check if a number is positive, negative or zero using Python?
- Check if product of digits of a number at even and odd places is equal in Python
- Java program to find whether given number is even or odd

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Python's modulo (%) operator (also called remainder operator) is useful to determine if a number is odd or even. We obtain remainder of division of a number by 2. If it is 0 , it is even otherwise it is odd

no=int(input('enter number')) if no%2==0: print ('{} is even'.format(no)) else: print ('{} is odd'.format(no))

The output

enter number25 25 is odd enter number40 40 is even

Advertisements