0% found this document useful (0 votes)
42 views6 pages

Pattern Program

Uploaded by

maangoo567
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)
42 views6 pages

Pattern Program

Uploaded by

maangoo567
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/ 6

Pattern Programs

Write a Code using C/Java to print the following patterns using Nested Loop Concepts

Right Half Pyramid Pattern

* | 1 | A
* * | 1 2 | A B
* * * | 1 2 3 | A B C
* * * * | 1 2 3 4 | A B C D
* * * * * | 1 2 3 4 5 | A B C D E

Left Half Pyramid Pattern

* | 1 | A
* * | 1 2 | A B
* * * | 1 2 3 | A B C
* * * * | 1 2 3 4 | A B C D
* * * * * | 1 2 3 4 5 | A B C D E

Full Pyramid Pattern

* | 1 | A
* * * | 1 2 3 | A B C
* * * * * | 1 2 3 4 5 | A B C D E
* * * * * * * | 1 2 3 4 5 6 7 | A B C D E F G
* * * * * * * * * | 1 2 3 4 5 6 7 8 9 | A B C D E F G H I

Inverted Right Half Pyramid Pattern

* * * * * | 1 2 3 4 5 | A B C D E
* * * * | 1 2 3 4 | A B C D
* * * | 1 2 3 | A B C
* * | 1 2 | A B
* | 1 | A
Inverted Left Half Pyramid Pattern

* * * * * | 1 2 3 4 5 | A B C D E
* * * * | 1 2 3 4 | A B C D
* * * | 1 2 3 | A B C
* * | 1 2 | A B
* | 1 | A

Inverted Full Pyramid Pattern

* * * * * * * * * | 1 2 3 4 5 6 7 8 9 | A B C D E F G H I
* * * * * * * | 1 2 3 4 5 6 7 | A B C D E F G
* * * * * | 1 2 3 4 5 | A B C D E
* * * | 1 2 3 | A B C
* | 1 | A

Rhombus Pattern

* * * * * | 1 2 3 4 5 | A B C D E
* * * * * | 1 2 3 4 5 | A B C D E
* * * * * | 1 2 3 4 5 | A B C D E
* * * * * | 1 2 3 4 5 | A B C D E
* * * * * | 1 2 3 4 5 | A B C D E

Diamond Pattern

* | 1 | A
* * * | 1 2 3 | A B C
* * * * * | 1 2 3 4 5 | A B C D E
* * * * * * * | 1 2 3 4 5 6 7 | A B C D E F G
* * * * * * * * * | 1 2 3 4 5 6 7 8 9 | A B C D E F G H I
* * * * * * * | 1 2 3 4 5 6 7 | A B C D E F G
* * * * * | 1 2 3 4 5 | A B C D E
* * * | 1 2 3 | A B C
* | 1 | A
Hourglass Pattern

* * * * * * * * * | 1 2 3 4 5 6 7 8 9 | A B C D E F G H I
* * * * * * * | 1 2 3 4 5 6 7 | A B C D E F G
* * * * * | 1 2 3 4 5 | A B C D E
* * * | 1 2 3 | A B C
* | 1 | A
* * * | 1 2 3 | A B C
* * * * * | 1 2 3 4 5 | A B C D E
* * * * * * * | 1 2 3 4 5 6 7 | A B C D E F G
* * * * * * * * * | 1 2 3 4 5 6 7 8 9 | A B C D E F G H I

Hollow Square Pattern

* * * * * | 1 2 3 4 5 | A B C D E
* * | 1 5 | A E
* * | 1 5 | A E
* * | 1 5 | A E
* * * * * | 1 2 3 4 5 | A B C D E

Hollow Full Pyramid Pattern

* | 1 | A
* * | 1 3 | A C
* * | 1 5 | A E
* * | 1 7 | A G
* * * * * * * * * | 1 2 3 4 5 6 7 8 9 | A B C D E F G H I

Hollow Inverted Full Pyramid Pattern

* * * * * * * * * | 1 2 3 4 5 6 7 8 9 | A B C D E F G H I
* * | 1 7 | A G
* * | 1 5 | A E
* * | 1 3 | A C
* | 1 | A
Hollow Diamond Pattern

* | * | A
* * | * * | A C
* * | * * | A E
* * | * * | A G
* * | * * | A I
* * | * * | A G
* * | * * | A E
* * | * * | A C
* | * | A
Hollow Hourglass Pattern
* * * * * * * * * | 1 2 3 4 5 6 7 8 9 | A B C D E F G H I
* * | 1 7 | A G
* * | 1 5 | A E
* * | 1 3 | A C
* | 1 | A
* * | 1 3 | A C
* * | 1 5 | A E
* * | 1 7 | A G
* * * * * * * * * | 1 2 3 4 5 6 7 8 9 | A B C D E F G H I
Floyd’s Triangle
1 | A
2 3 | B C
4 5 6 | D E F
7 8 9 10 | G H I J
Pascal’s Triangle
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1
0 1
1 0 1
0 1 0 1
1 0 1 0 1
0 1 0 1 0 1

1
2 1 2
3 2 1 2 3
4 3 2 1 2 3 4
5 4 3 2 1 2 3 4 5
6 5 4 3 2 1 2 3 4 5 6

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

You might also like