Check Divisible by 5 and 11

Check whether a given integer is divisible by both 5 and 11.

BeginnerTopic: Conditional Programs
Back

What You'll Learn

  • Checking multiple conditions with and
  • Using modulo for divisibility tests
  • Combining simple conditions into composite logic

Python Check Divisible by 5 and 11 Program

This program helps you to learn the fundamental structure and syntax of Python programming.

Try This Code
# Program to check if a number is divisible by both 5 and 11

num = int(input("Enter an integer: "))

if num % 5 == 0 and num % 11 == 0:
    print(num, "is divisible by both 5 and 11")
else:
    print(num, "is not divisible by both 5 and 11")
Output
Enter an integer: 55
55 is divisible by both 5 and 11

Step-by-Step Breakdown

  1. 1Read an integer from the user.
  2. 2Compute num % 5 and num % 11.
  3. 3If both remainders are zero, print that it is divisible by both.
  4. 4Otherwise, print that it is not.

Understanding Check Divisible by 5 and 11

We use the modulo operator and logical AND:

num % 5 == 0 checks divisibility by 5.
num % 11 == 0 checks divisibility by 11.
Both must be true simultaneously for the number to be divisible by both.

Note: To write and run Python programs, you need to set up the local environment on your computer. Refer to the complete article Setting up Python Development Environment. If you do not want to set up the local environment on your computer, you can also use online IDE to write and run your Python programs.