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
-----------------------------------
#include<stdio.h>
#include<conio.h>
int main( )
{
int r,c,askey;
clrscr( );
for( r=7; 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();
return 0;
}
Output:-
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
Note:-
'r' and 'c' means rows and columns .
'askey' variable is for disp. values.
program is wrong please correct it
ReplyDelete