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