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

C Programming Practice

The document contains instructions for 6 programming assignments involving printing different patterns based on an input value of n. For assignment 1, it provides sample outputs for patterns of stars and underscores when n=4 and n=5. For assignments 2 through 5, it provides more sample patterns containing stars, underscores, and dollar signs for various values of n. Assignment 6 provides even more complex patterns containing stars and underscores for increasing values of n from 2 to 4.

Uploaded by

virtualfighter
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

C Programming Practice

The document contains instructions for 6 programming assignments involving printing different patterns based on an input value of n. For assignment 1, it provides sample outputs for patterns of stars and underscores when n=4 and n=5. For assignments 2 through 5, it provides more sample patterns containing stars, underscores, and dollar signs for various values of n. Assignment 6 provides even more complex patterns containing stars and underscores for increasing values of n from 2 to 4.

Uploaded by

virtualfighter
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

United International University

Dept. of Computer Science & Engineering


Structured Programming Language Sessional
Course Code CSI 122
Fall-2013
Assignment-03

Solve all the problems using C language.


Print the following pattern based on input n.
1. For n = 4
Output:
1_____1
12___21
123_321
1234321
2. For n = 5 (only odd inputs)
Output:
*****
*___*
*****
*___*
*****
3. For n = 5
Output:
10101
01010
10101
01010
10101
4. Print the following pattern based on value of n.
When n = 5

When n = 7

When n = 9

*___*
_*_*_
__*__
_*_*_
*___*

*_____*
_*___*_
__*_*__
___*___
__*_*__
_*___*_
*_____*

*_______*
_*_____*_
__*___*__
___*_*___
____*____
___*_*___
__*___*__
_*_____*_
*_______*

Page 1 of 2

5. Print the following pattern based on value of n.


When n = 9

When n = 13

When n = 17

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

______$______
_____$$$_____
____$_$_$____
___$__$__$___
__$___$___$__
_$____$____$_
$$$$$$$$$$$$$
_$____$____$_
__$___$___$__
___$__$__$___
____$_$_$____
_____$$$_____
______$______

________$________
_______$$$_______
______$_$_$______
_____$__$__$_____
____$___$___$____
___$____$____$___
__$_____$_____$__
_$______$______$_
$$$$$$$$$$$$$$$$$
_$______$______$_
__$_____$_____$__
___$____$____$___
____$___$___$____
_____$__$__$_____
______$_$_$______
_______$$$_______
________$________

6. Print the following pattern based on value of n.


When n = 2

When n = 3

When n = 4

*
**
__*
__**

*
**
***
___*
___**
___***
______*
______**
______***

*
**
***
****
____*
____**
____***
____****
________*
________**
________***
________****
____________*
____________**
____________***
____________****

Page 2 of 2

You might also like