Even Odd Program in Python
Even Numbers : Those numbers which are completely divisible by 2 are called even numbers. for example : 2, 4, 6, 8 are even numbers. When we divide 242 by 2, it returns remainder ZERO which shows that 242 is an even number.
Odd Numbers : Those numbers which are not completely divisible by 2 are called odd numbers. for example when we divide 31 by 2, it returns remainder ONE, which shows that it is an odd number.
In Python Modulus Operator(%) is used to find the remainder. for example
print(75 % 2) will print 1 # Since remainder is 1 so 75 is an odd number print(44 % 2) will print 0 # Since remainder is 0 so 44 is an even number
Even Odd Program in Python
Write a program in Python to check whether a number (accepted from user) is even or odd.
Output of above program
Explanation of above program :
First input function is used to accept a number from the user. In next line, we are using simple if along with modulus operator to check the remainder. If the remainder is ZERO, then the program will print a message for even number, otherwise, the program will print a message for odd number.
MCQ of Computer Science Chapter Wise
2. Flow of Control (Loop and Conditional statement)
3. 140+ MCQ on Introduction to Python
4. 120 MCQ on String in Python
7. 100+ MCQ on Flow of Control in Python
8. 60+ MCQ on Dictionary in Python
Important Links
100 Practice Questions on Python Fundamentals
120+ MySQL Practice Questions
90+ Practice Questions on List
50+ Output based Practice Questions
100 Practice Questions on String
70 Practice Questions on Loops
70 Practice Questions on if-else
Disclaimer : I tried to give you the correct coding of ” Even Odd Program in Python ” , but if you feel that there is/are mistakes in the code or explanation of “ Even Odd Program in Python “ given above, you can directly contact me at csiplearninghub@gmail.com.