0% found this document useful (0 votes)
231 views

06 Nested Loop

The document contains 16 problems involving printing patterns based on a user-input integer (n). The problems range in difficulty from * to ***, with most being * or ** level, and involve printing numeric, alphabetic, or symbol patterns that follow various rules as specified by the sample input/output provided for each problem. The patterns require the use of basic looping and conditional logic.

Uploaded by

tanvir ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
231 views

06 Nested Loop

The document contains 16 problems involving printing patterns based on a user-input integer (n). The problems range in difficulty from * to ***, with most being * or ** level, and involve printing numeric, alphabetic, or symbol patterns that follow various rules as specified by the sample input/output provided for each problem. The patterns require the use of basic looping and conditional logic.

Uploaded by

tanvir ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Nested Loop related problems (total 18 questions)

Difficulty
SL Problem statement
levels
1. WAP that will print a pattern based on the input integer n. Please see the sample input *
output.

Sample input Sample output


3 123
123
123
4 1234
1234
1234
1234

2. WAP that will print a pattern based on the input integer n. Please see the sample input *
output.

Sample input Sample output


3 123
234
345
4 1234
2345
3456
4567

3. WAP that will print a pattern based on the input integer n. Please see the sample input *
output.

Sample input Sample output


3 1
23
345
4 1
23
345
4567
4. WAP that will print a pattern based on the input integer n. Please see the sample input **
output.

Sample input Sample output


3 __1
_22
333
5 ____1
___22
__333
_4444
55555

5. WAP that will print a pattern based on the input integer n. Please see the sample input *
output.

Sample input Sample output


3 3
32
321
4 4
43
432
4321

6. WAP that will print a pattern based on the input integer n. Please see the sample input *
output.

Sample input Sample output


3 1
12
123
4 1
12
123
1234
7. WAP that will print a pattern based on the input integer n. Please see the sample input *
output.

Sample input Sample output


4 ****

****

****

****

2 **
**

8. WAP that will print a pattern based on the input integer n. Please see the sample input *
output.

Sample input Sample output


5 *****

****

***

**

2 **
*

9. WAP that will print a pattern based on the input integer n. Please see the sample input **
output.

Sample input Sample output


5 10101

01010

10101

01010

10101

3 101
010

101
10. WAP that will print a pattern based on the input integer n. Please see the sample input **
output.

Sample input Sample output


5 ____*

___**

__***

_****

*****

3 __*

_**

***

11. WAP that will print a pattern based on the input integer n. Please see the sample input **
output.

Sample input Sample output


5 ____*

___***

__*****

_*******

*********

3 __*

_***

*****

12. WAP that will print a pattern based on the input odd integer n. Please see the sample ***
input output.

Sample input Sample output


9 ____*
___***

__*****

_*******

*********

_*******

__*****

___***

____*

3 _*

***

_*

13. WAP that will print a pattern based on the input integer n. Please see the sample input **
output.

Sample input Sample output


4 1_____1

12___21

123_321

1234321

3 1___1

12_21

12321

14. WAP that will print a pattern based on the input odd integer n. Please see the sample **
input output.
Sample input Sample output
5 *****

*___*

*****

*___*

*****

3 ***

*_*

***

15. WAP that will print a pattern based on the input odd integer n. Please see the sample **
input output.
Sample input Sample output
5 ZZZZZ

ZZZZZ

7 ZZZZZZZ

ZZZZZZZ
16. WAP that will print a pattern based on the input odd integer n. Please see the sample **
input output.

Sample input Sample output


5 *___*
_*_*_
__*__
_*_*_
*___*
7 *_____*
_*___*_
__*_*__
___*___
__*_*__
_*___*_
*_____*

17. WAP that will print a pattern based on the input odd integer n. Please see the sample ***
input output.

Sample input Sample output


9 ____$____
___$$$___
__$_$_$__
_$__$__$_
$$$$$$$$$
_$__$__$_
__$_$_$__
___$$$___
____$____

13 ______$______
_____$$$_____
____$_$_$____
___$__$__$___
__$___$___$__
_$____$____$_
$$$$$$$$$$$$$
_$____$____$_
__$___$___$__
___$__$__$___
____$_$_$____
_____$$$_____
______$______
18. WAP that will print a pattern based on the input odd integer n. Please see the sample **
input output.

Sample input Sample output


5 H H

H H

HHHHH

H H

H H

7 H H

H H

H H

HHHHHHH

H H

H H

H H

You might also like