Python Practice › Loop Programs › Program 52

Numbers from 0 to 100 divisible by 5

EasyLoop Programs · 52 of 90

Write a Python program to find the numbers from 0 to 100 divisible by 5.

Advertisement
Output
[0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]

Approach

  1. Keep numbers with n % 5 == 0.

Solution

Python
print([n for n in range(0, 101) if n % 5 == 0])
Output
[0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]

Learn the concept

New to this topic? Read the lesson, then come back.

More loop programs

← All 90 Loop Programs

Leave a Comment