Well, my preference would be to work with a string so that I wouldn't have to assume the ASCII character set:
Code:
#include <stdio.h>
int main ( void )
{
char *p = "FEDCBA";
int i, j;
for ( i = 0; p[i] != '\0'; i++ ) {
for ( j = 0; j <= i; j++ )
printf ( "%c", p[j] );
printf ( "\n" );
}
return 0;
}
But, with the right assumptions in hand, your way works too:
Code:
#include <stdio.h>
int main ( void )
{
char i, j;
for ( i = 'F'; i >= 'A'; i-- ) {
for ( j = 'F'; j >= i; j-- )
printf ( "%c", j );
printf ( "\n" );
}
return 0;
}