57. Python Program to find Numbers Divisible by both 3 and 7 from 1 to 100 numbers.
How does this program work?
- In this program we are going to learn about how to find the numbers which are divisible by both 3 and 7 from 1 to 100 numbers using Python.
- When the number is divided by both 3 and 7, we use the remainder operator % to compute the remainder.
- If the remainder is zero, then that number is divisible of both 3 and 7.
- After doing this for each value, then we get the numbers from 1 to 100.
Here is the code
print("Numbers which are divisible by both 3 and 7 from 1 to 100 are: ")
for i in range(1,100):
if (i % 3 == 0 and i % 7 == 0):
print(i)