Computer Science

Write programs using nested loops to produce the following patterns:

2
4 4
6 6 6
8 8 8 8

Python

Python Control Flow

21 Likes

Answer

for i in range(2, 10, 2) :
    for j in range(2, i + 1, 2) :
        print(i, end = ' ')
    print()

Output

2 
4 4 
6 6 6
8 8 8 8

Answered By

8 Likes


Related Questions