Program to print the following alphabetical pattern:-
#include<conio.h>
void main()
{
char j,k;
int h,i;
for(j='A';j<'H';j++)
{ cout<<j; }
for(k=j-2;k>='A';k--)
{ cout<<k; }
for(i=1;i<8;i++)
{
cout<<endl;
for(j='A';j<'H'-i;j++)
{
cout<<j;
}
for(h=1;h<2*(i);h++)
{
cout<<" ";
}
for(k=j-1;k>='A';k--)
{
cout<<k;
}
}
getch();
}
No comments:
Post a Comment