Page Rank

Write a C program to print the given alphabet pyramid.


A B C D E F G G F E D C B A
A B C D E F F E D C B A
A B C D E E D C B A
A B C D D C B A
A B C C B A
A B B A
A A
-----------------------------------

#include
#include
int main( )
{
  int r,c,askey;
  clrscr( );
  
  for( r=7; r>=1; r-- )
  {
    askey=65;
    for(c=1; c<=r; c++ )
      printf("%2c", askey++ );
    askey--; 
    for(c=r; c>=1; c-- )
       printf("%2c", askey--);
   
   printf("\n");
  }
  getch();
  return 0;
}
 
Output:- 
A B C D E F G G F E D C B A
A B C D E F F E D C B A
A B C D E E D C B A
A B C D D C B A
A B C C B A
A B B A
A A
Note:- 
'r' and 'c' means rows and columns .
'askey' variable is for disp. values.

5 comments:

Ravi Verma said...

Here i am trying to solve a question. I want to make a program in C++ format(not in C format) which results in a PYRAMID OF ALPHABETS as shown below:
A
AB
ABC
ABCD
ABCDE

I have found a similar solution for this problem but that was in C language format not in C++ format. I will b thankfull to u if u provide me the solution in C++ format.

lakshmi narayan reddy said...

C PROGRAM TO PRINT ALPHABETS IN FOLLOWING FASHION

ABCDEFGHIJKLMNOPQRSTUVWXYZ
BCDEFGHIJKLMNOPQRSTUVWXY
CDEFGHIJKLMNOPQRSTUVWX
DEFGHIJKLMNOPQRSTUVW
EFGHIJKLMNOPQRSTUV
FGHIJKLMNOPQRSTU
GHIJKLMNOPQRST
HIJKLMNOPQRS
IJKLMNOPQR
JKLMNOPQ

సతీష్ said...

#include
int main( )
{
int r,c,askey,j=0;


for( r=j; r<=25;r++)
{
askey=65+r;
for(c=r; c<=25; c++ )
printf("%2c", askey++ );


printf("\n");


}

return 0;
}

desizalim said...

A
A A
A A A
A A

CODE NEEDED...PLZ HELP

desizalim said...

to print any size of pattern of "A"