Use a loop inside a loop to create the following pattern:
ABCDE
ABCD
ABC
AB
A
This is what I got, I got the answer by trial and error and still don't understand how this works. Can anyone help explain How these nested for loops work, what statements control what (row/column). Or if there's another answer possible.
Thanks in advance.
Code:#include <stdio.h> int main(void) { const int ROWS = 5; const int CHARS = 5; int row; char ch; for (row = 0; row < ROWS; row++) { for (ch = ('F' - CHARS); ch < ('F' - row); ch++) printf("%c", ch); printf("\n"); } return 0; }