Write a C program to print the given alphabet pyramid -2

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 


#include
#incldue
int main( )
{
  int r,c,askey,sp;
  clrscr( );
  
  for( r=7; r>=1; r-- )
  {
    for(sp=6; sp>=r; sp--)
        printf("  "); //2 spaces

    askey=65;
    for(c=1; c<=r; c++ )
      printf("%2c", askey++ );
    
    for(c=r-1; c>=1; c-- )
       printf("%2c", --askey);
   
   printf("\n");
  }
  getch();
  return 0;
}

Output:-
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 

#vpsinghrajput

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

2 comments:

  1. hey buddy!!!
    the output is coming wrong here..... its coming as,
    A B C D E F G g F E D C B
    A B C D E F f E D C B
    A B C D E e D C B
    A B C D d C B
    A B C c B
    A B b
    A

    ReplyDelete
  2. Hi Cnraj23 output is write. PLZ review your program again. or contact me by mail Emial ID:- cs3.vijay@gmail.com

    ReplyDelete