Python Practice › Loop Programs › Program 45

Count even numbers 1 to 100

EasyLoop Programs · 45 of 90

Write a Python program to count the even numbers from 1 to 100.

Advertisement
Output
50

Approach

  1. Increase a counter for each number with remainder 0.

Solution

Python
count = 0for n in range(1, 101):    if n % 2 == 0:        count += 1print(count)
Output
50

Learn the concept

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

More loop programs

← All 90 Loop Programs

Leave a Comment