by Sai gowtham

How to check if a number is multiple of 10 in Python

In this tutorial, we are going to learn about how to check if a given number is multiple of 10 or not in Python.

Consider, we have a following number:

a = 100

To find if a above number 100 is a multiple of 10 the number should be divided by 10 and the remainder is 0.

Using % Modulo operator

To check if a number is multiple of 10 or not, we can use the % modulo operator in Python.

The modulo % operator returns the remainder of two numbers 100 % 10, so if we get a remainder 0 then the given number is a multiple of 10.

Here is an example:

a = 100

if a % 10 == 0 :
   print("a is multiple of 10")
else:
   print("a is not a muliple of 10")

Output:

"a is multiple of 10"

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

Example 2 :

b = 300

if b % 10 == 0 :
   print("b is multiple of 10")
else:
   print("b is not a muliple of 10")

Output:

"b is multiple of 10"

Checking if a number is not a multiple of 10

To check if a number is not a multiple of 10, 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 a multiple of 10")

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

Css Tutorials & Demos

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)
JavaScript - The Complete Guide 2022 (Beginner + Advanced)
116,648 students enrolled
52 hours of video content
$14.99 FROM UDEMY
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
631,582 students enrolled
49 hours of video content
$24.99 FROM UDEMY
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
203,937 students enrolled
31.5 hours of video content
$14.99 FROM UDEMY