CBSE Class 11 Computer Science Question 155 of 161

Flow of Control — Question 32

Back to all questions
32
Question

Question 25c

Write programs using nested loops to produce the following patterns:

0
2 2
4 4 4
6 6 6 6
8 8 8 8 8

Solution
for i in range(0, 10, 2):
    for j in range(0, i + 1, 2) :
        print(i, end = ' ')
    print()
Output
0 
2 2 
4 4 4
6 6 6 6
8 8 8 8 8
Answer