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

Basic Pattern Questions

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

Basic Pattern Questions

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

Basic Star Pattern Questions in C

1. Right-Angled Triangle with Numbers

Print a right-angled triangle where numbers increase row by row.

Input: n = 5

Output:

12

123

1234

12345

2. Inverted Right-Angled Triangle

Print an inverted right-angled triangle of stars.

Input: n = 5

Output:

*****

****

***

**

3. Pyramid Pattern

Print a pyramid pattern of stars.

Input: n = 5

Output:

***

*****
*******

*********

4. Diamond Pattern

Print a diamond-shaped star pattern.

Input: n = 5

Output:

***

*****

*******

*********

*******

*****

***

5. Square Border

Print a square with stars on the border only.

Input: n = 5

Output:

*****

* *

* *

* *

*****

You might also like