top of page

Pyramids and Patterns Programs in C

Updated: Aug 14, 2022



1. Half Pyramid of * programs in C

*

* *

* * *

* * * *

* * * * *


Program:

#include <stdio.h>

#include<conio.h>

void main()

{

int i, j;

clrscr();

for (i = 1; i <= 5; ++i)

{

for (j = 1; j <= i; ++j)

{

printf("* ");

}

printf("\n");

}

getch();

}


2. C program of Inverted half pyramid of *

* * * * *

* * * *

* * *

* *

*

Program:

#include <stdio.h>

#include<conio.h>

void main()

{

int i, j;


for (i = 5; i >= 1; --i)

{

for (j = 1; j <= i; ++j)

{

printf("* ");

}

printf("\n");

}

getch();

}

3. C program for Half Pyramid of Numbers


1

1 2

1 2 3

1 2 3 4

1 2 3 4 5


Program:

#include <stdio.h>

#include<conio.h>

void main()

{

int i, j;

clrscr();

for (i = 1; i <= 5; ++i)

{

for (j = 1; j <= i; ++j)

{

printf("%d ", j);

}

printf("\n");

}

getch();

}



4. C Program for Inverted half pyramid of numbers:


1 2 3 4 5

1 2 3 4

1 2 3

1 2

1


Program:

#include <stdio.h>

#include<conio.h>

void main()

{

int i, j;

for (i = 5; i >= 1; --i)

{

for (j = 1; j <= i; ++j)

{

printf("%d ", j);

}

printf("\n");

}

getch();

}


5. C program for Half Pyramid of Alphabets:

A

B B

C C C

D D D D

E E E E E


Program:

#include <stdio.h>

#include<conio.h>

void main()

{

int i, j;


for (i = 1; i <= 5; i++)

{

for (j = 1; j <= i;j++)

{

printf("%c ", 'A'-1+i);

}

printf("\n");

}

getch();

}



6.C Program for Alphabet pattern:

A

AB

ABC

ABCD

ABCDE

Program:

#include<stdio.h>

#include<conio.h>

void main()

{

int i, j;

for(i=1;i<=5;i++)

{

for(j=1;j<=i;j++)

{

printf("%c",'A' + j-1);

}

printf("\n");

}

getch();

}


7. C Program for Alphabet pattern:

A

BA

CBA

DCBA

EDCBA


Program:

#include <stdio.h>

#include<conio.h>

void main()

{

int i, j;

for(i=1;i<=5;i++)

{

for(j=i;j>=1;j--)

{

printf("%c",'A' + j-1);

}

printf("\n");

}

getch();

}



8. C Program Alphabet pattern:


EEEEE

DDDD

CCC

BB

A


Program:

#include <stdio.h>

#include<conio.h>

void main()

{

int i, j;

for(i=5;i>=1;i--)

{

for(j=1;j<=i;j++)

{

printf("%c",'A'-1 + i);

}

printf("\n");

}

getch();

}


9. C program for below Alphabet pattern:

A

BC

DEF

GHIJ

KLMNO

Program:

#include <stdio.h>

#include<conio.h>

void main()

{

int i,j;

char ch='A';

for(i=1;i<=5;i++)

{

for(j=1;j<=i;j++)

{

printf("%c ",ch++);

}

printf("\n");

}

getch();

}

10. C Program for Alphabet pattern below:

A

ABC

ABCDE

ABCDEFG

ABCDEFGI


Program:

#include<stdio.h>

#include<conio.h>

void main()

{

int i,j,n=5;

for(i=1;i<=n;i++)

{

for(j=1;j<=(i*2-1);j++)

{

printf("%c",(char)(j+64));

}

printf("\n");

}

getch();

}


11. C Program for below Full Pyramid of *


*

* * *

* * * * *

* * * * * * *

* * * * * * * * *


Program:

#include <stdio.h>

#include<conio.h>

void main()

{

int i, space, k = 0;

for (i = 1; i <= 5; ++i, k = 0)

{

for (space = 1; space <= 5 - i; ++space)

{

printf(" ");

}

while (k != 2 * i - 1)

{

printf("* ");

++k;

}

printf("\n");

}

getch();

}



 
 
 

Recent Posts

See All
NIELIT CCC MCQ Questions with Answers

Q1. Which protocol is used to upload and download file? (A) TCP (B) HTTP (C) FTP (D) SMTP Ans: C Q2. How many is Number of digits in a Visa Card number? (A) 15 (B) 16 (C) 18 (D) 19 Ans: B Q3. What is

 
 
 
IT Tools and Network Basics MCQ

Q1. Presentation file created in LibreOffice Impress is saved with the extension…. लिब्रे ऑफिस इंप्रेस में बनाई गई प्रेजेंटेशन फ़ाइल एक्सटेंशन के साथ सेव की जाती है .ods .odt .ott .odp Ans: D Q2. So

 
 
 

1 Comment


apotw
Apr 14, 2025

Indwin is one of the best platforms for online gambling. The interface is easy to use, and the games are always fun.

Like
bottom of page