# Checking if a number is divisible by another number in Python

In this tutorial, we are going to learn about how to check if a number is divisible by another number in Python with the help of examples.

Consider, we have a following number:

``a = 10``

To find if a above number `10` is divisible by another number, we should divide the first number by second and get the remainder 0 then only we call it’s a divisible of another number otherwise it is not a divisible.

For example: 10%5 = 0

## Using % Modulo operator

To check if a number is divisible by another number, we can use the `%` modulo operator in Python.

The modulo `%` operator returns the remainder of two numbers `100 % 10 = 0`, so if we get a remainder `0` then the given number is a divisible of another number otherwise it not a divisible.

Here is an example:

``````
if 10 % 5 == 0 :
print("10 is divisible by 5")
else:
print("10 is not divisible by 5")``````

Output:

``"10 is divisible by 5"``

In the above code we have added `10 % 5 == 0` in if condition, so 10 is divided by 5 and returns the remainder 0 then it prints the output “10 is divisible by 5”.

Example 2 :

``````if 20 % 4 == 0 :
print("20 is divisible by 4")
else:
print("20 is not divisible by 4")``````

Output:

``"20 is divisible by 4"``

## Checking if a number is not divisible by another

To check if a number is not a divisible of another number, we can use the modulo operator `%` but the remainder of first number by second number is not equal to 0.

Here is an example:

``````if (23 % 10 != 0):
print ("23 is not divisible by 10")``````

In the above code, 23 is divided by 10 and returns the remainder 3. So the given number is not divisible of 10.

## How rotate an image continuously in CSS

In this demo, we are going to learn about how to rotate an image continuously using the css animations.

## How to create a Instagram login Page

In this demo, i will show you how to create a instagram login page using html and css.

## How to create a pulse animation in CSS

In this demo, i will show you how to create a pulse animation using css.

## Creating a snowfall animation using css and JavaScript

In this demo, i will show you how to create a snow fall animation using css and JavaScript.

## Top Udemy Courses

##### JavaScript - The Complete Guide 2022 (Beginner + Advanced)
64,026 students enrolled
52 hours of video content
View Course
##### React - The Complete Guide (incl Hooks, React Router, Redux)
284,472 students enrolled
40 hours of video content
View Course
##### Vue - The Complete Guide (w/ Router, Vuex, Composition API)
152,857 students enrolled
48.5 hours of video content
View Course