[Type C]Q2. Write a program that returns True if the input number is an even number, False otherwise.

If-Else syntax:

if (condition):
elif (condition):

If else flowchart:

Program code:

Clear Doubts with Computer Tutor
In case you’re facing problems in understanding concepts, writing programs, solving questions, want to learn fun facts | tips | tricks or absolutely anything around computer science, feel free to join CTs learner-teacher community: students.computertutor.in


Enter any number:66

In the above program, a number is input from user. It is then divided by 2 to check the remainder using ‘modulus’ or % function.

If the remainder is equal to 0, the number is said to be divisible by 2 and is an even number, or else it cannot be divided by 2 and is an odd number.

Basic python functionality is demonstrated in above program.

To view all the lessons in chapter 1: http://computertutor.in/class-12-computer-science/chapter-1/

To view entire class 12 computer science study material: http://computertutor.in/resources/

You cannot copy content of this page