Python Practice › Loop Programs › Program 70

Table of 2 with a while loop

EasyLoop Programs · 70 of 90

Write a Python program to print the table of 2 using a while loop.

Advertisement
Output
2 x 1 = 2
2 x 2 = 4
2 x 3 = 6
2 x 4 = 8
2 x 5 = 10
2 x 6 = 12
2 x 7 = 14
2 x 8 = 16
2 x 9 = 18
2 x 10 = 20

Approach

  1. Use a counter from 1 to 10.

Solution

Python
i = 1while i <= 10:    print(f"2 x {i} = {2 * i}")    i += 1
Output
2 x 1 = 2
2 x 2 = 4
2 x 3 = 6
2 x 4 = 8
2 x 5 = 10
2 x 6 = 12
2 x 7 = 14
2 x 8 = 16
2 x 9 = 18
2 x 10 = 20
Advertisement

Learn the concept

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

More loop programs

← All 90 Loop Programs