Home » Pyramid Patterns in C

Pyramid Patterns in C

by Online Tutorials Library

Pyramid Patterns in C

This section will discuss the Pyramid pattern of numbers, Stars, and alphabets in the C programming language. All Pyramid patterns are in a polygon structure. The interviewer usually asks these patterns to examine the logical and thinking ability of the programmer. Once we understand the logic of the code, we can create various Pyramid patterns in C language and C++, JAVA, PYTHON, PHP, etc. programming languages.

Now we will create the various patterns of Pyramids in C programming languages using loops and if statements.

1. Star Pyramid Patterns

Program to print the half Pyramid

Let’s consider an example to print the half Pyramid pattern using for loop.

star.c

Output

Pyramid Patterns in C

Program to print an inverted half Pyramid Pattern

Let’s consider an example to print the Inverted half Pyramid pattern using for loop.

star.c

Output

Pyramid Patterns in C

Program to print an inverted right half Pyramid

Let’s consider an example to print a reverse right half Pyramid pattern using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the right half Pyramid

Let’s consider an example to print the right half Pyramid pattern using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the full Pyramid of Star in 180 degree

Let’s consider an example to print the full Pyramid of Star in 180 degree using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the full Pyramid of Star in the opposite direction

Let’s consider an example to print the full Pyramid of Star in the opposite direction of 180 degrees using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the full Pyramid of Star

Let’s consider an example to print the full Pyramid of Star using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the inverted full Pyramid of Star

Let’s consider an example to print the full Pyramid of Star using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the rhombus pattern of Star

Let’s consider an example to print the rhombus pattern of Star using for loop.

star.c

Output

Pyramid Patterns in C

2. Number Pyramid Patterns

Program to print the half Pyramid of number

Let’s consider an example to print the half Pyramid pattern using for loop.

star.c

Output

Pyramid Patterns in C

Example 2:

Let’s consider an example to print the half Pyramid pattern of number using for loop.

Star.c

Output

Pyramid Patterns in C

Program to print an inverted half Pyramid Pattern

Let’s consider an example to print the Inverted half Pyramid pattern using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the right half Pyramid of number

Let’s consider an example to print the right half Pyramid pattern of number using for loop.

star.c

Output

Pyramid Patterns in C

Program to print an inverted right half Pyramid of number

Let’s consider an example to print a reverse right half Pyramid pattern of number using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the Floyd triangle

Let’s consider an example to print the Floyd Pyramid pattern using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the diamond shaped Pyramid of number

Let’s consider an example to print the diamond shaped Pyramid using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the full Pyramid of number

Let’s consider an example to print the full Pyramid of number using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the inverted full Pyramid of number

Let’s consider an example to print the inverted full Pyramid of number using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the Pascal triangle

Let’s consider an example to print the Pascal triangle using for loop.

star.c

Output

Pyramid Patterns in C

Program to combine two half Pyramid of number

Let’s consider an example to print the combination of two half Pyramid of number..

star.c

Output

Pyramid Patterns in C

3. Alphabets Pyramid Patterns

Program to print the half Pyramid of alphabets

Let’s consider an example to print the half Pyramid pattern using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the inverted half Pyramid of alphabets

Let’s consider an example to print the half Pyramid pattern using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the right half Pyramid of alphabets

Let’s consider an example to print the half Pyramid pattern using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the inverted half Pyramid of alphabets

Let’s consider an example to print the half Pyramid pattern using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the full Pyramid of alphabets

Let’s consider an example to print the full Pyramid pattern using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the inverted full Pyramid of alphabets

Let’s consider an example to print the full Pyramid pattern using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the diamond shaped Pyramid of alphabets

Let’s consider an example to print the full Pyramid pattern using for loop.

star.c

Output

Pyramid Patterns in C

Program to print the full Pyramid of alphabets in 180 degrees

Let’s consider an example to print the full Pyramid pattern in 180 degrees using for loop.

star.c

Output

Pyramid Patterns in C


You may also like