[Type C]Q4. Write a Python program that accepts two integers from the user and prints a message saying if the first number is divisible by the second number or it is not.

If-Else syntax:

if (condition):
 statement
elif (condition):
 statement 
else:
 statement

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

Output:

Enter Two numbers:10 5
First number is divisible by second

In the above program, two numbers are taken as input from user, then the first number is taken modulus by second number to check remainder.

If the remainder is equal to zero, First number is said to be divisible by second.

If the remainder is not equal to zero, First number is not divisible by second.

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