Followers

Thursday, December 15, 2011

PYRAMID OF ALPHABETS

#include<iostream.h>
#include<conio.h>

void main()
{
 clrscr();
 int n;
 cout<<"Enter the number of lines : ";
 cin>>n;
 for( int i=1 ; i<=n ; i++ )
 {
   for ( int j=1 ; j<=n-i ; j++ )
    {
     cout<<" ";
    }
   for ( int k=1 ; k<=i ; k++ )
    {
     cout<<char (64+k);
    }


   for ( int l=i ; l>=2 ; l-- )
       cout<<char (63+l);


   cout<<"\n";
 }
 getch();
}
.................................................................
OUTPUT:(click to enlarge the image)

No comments:

Post a Comment