Skip to content

Instantly share code, notes, and snippets.

@sagardere
Created June 5, 2018 07:15
Show Gist options
  • Save sagardere/ca8711bb188246c6ab16d2417c1e398a to your computer and use it in GitHub Desktop.
Save sagardere/ca8711bb188246c6ab16d2417c1e398a to your computer and use it in GitHub Desktop.
#include<stdio.h>
//#include<conio.h>
int main( )
{
int r,c,askey,sp,num;
printf("\n\n\tC PROGRAM TO PRINT REVERSE PYRAMID OF ALPHABETS \n");
printf("\nEnter the number of rows you want to show in your reverse pyramid : ");
scanf("%d",&num);
printf("\n\n\n");
for( r=num; r>=1; r-- )
{
printf("\t");
for(sp=num-1; sp>=r; sp--)
printf(" "); //2 spaces
askey=65;
for(c=1; c<=r; c++ )
printf("%2c", askey++ );
--askey;
for(c=r-1; c>=1; c-- )
printf("%2c", --askey);
printf("\n");
}
//getch();
}
/*
I/P : Enter the number of rows you want to show in your reverse pyramid : 8
O/P :
A B C D E F G H G F E D C B A
A B C D E F G F E D C B A
A B C D E F E D C B A
A B C D E D C B A
A B C D C B A
A B C B A
A B A
A
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment