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
Write a program using nested loops to produce a rectangle of *'s with 6 rows and 20 *'s per row.
Given three numbers A, B and C, write a program to write their values in an ascending order. For example, if A = 12, B = 10, and C = 15, your program should print out:
Smallest number = 10
Next higher number = 12
Highest number = 15Write programs using nested loops to produce the following patterns:
0
2 2
4 4 4
6 6 6 6
8 8 8 8 8Write programs using nested loops to produce the following patterns:
A
B B
C C C
D D D D
E E E E E