#include<stdio.h>
#include<conio.h>
void main( )
{
int r,c,askey,sp,n;
clrscr( );
printf("Enter the number of row:\n");
scanf("%d",&n);
for(r=n;r>=1;r-- )
{
for(sp=n-1; 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-1);
printf("\n");
}
getch();
}
Output:-
Enter the number of row:7
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
No comments:
Post a Comment