Python is a powerful programming language that can be used to perform various tasks, including finding numbers that are divisible by another number.

In this tutorial, we’ll cover how to write a Python program to find numbers divisible by another number.

To find numbers divisible by another number, we’ll use the modulo operator in Python.

The modulo operator (%) returns the remainder of the division of two numbers.

If the remainder is zero, then the first number is divisible by the second number.

Here’s the Python program to find numbers divisible by another number:

# Prompt user to enter two numbers num1 = int(input("Enter the first number: ")) num2 = int(input("Enter the second number: ")) # Find numbers divisible by num2 for i in range(num1, num2): if i % num2 == 0: print(i)

In this program, we prompt the user to enter two numbers.

Then we use a for loop to iterate through the range of numbers between the first number and the second number.

If a number is divisible by the second number (i.e., the remainder is zero), we print that number.

Let’s walk through an example to see how the program works.

Suppose the user enters the numbers 1 and 10.

The program will iterate through the numbers 1 to 9 and check if each number is divisible by 10.

Since none of the numbers are divisible by 10, the program will not print anything.

Now suppose the user enters the numbers 10 and 20.

The program will iterate through the numbers 10 to 19 and check if each number is divisible by 20.

Since none of the numbers are divisible by 20, the program will not print anything.

Finally, suppose the user enters the numbers 1 and 6.

The program will iterate through the numbers 1 to 5 and check if each number is divisible by 6.

Since none of the numbers are divisible by 6, the program will not print anything.

In conclusion, finding numbers divisible by another number is a common task in programming, and Python makes it easy to accomplish this task using the modulo operator.

With the program above, you can easily find all the numbers that are divisible by another number.