Hey, all! I'm new to C programming and programming in general, and I am having trouble with a code that I can't get to work.
They want me to produce the following pattern:
F
FE
FED
FEDC
FEDCB
FEDCBA
This is my code so far:
Code:
#include <stdio.h>
void pattern(void)
{
const int ROWS = 0;
const int CHARS = 6;
int row;
char ch;
for (row = 7; row > ROWS; row--)
{
for (ch = ('F' - row); ch > ('F' - CHARS); ch--)
printf("%c", ch);
printf("\n");
}
}
It is producing the following pattern:
A
BA
CBA
DCBA
EDCBA
No matter how much I've been tinkering around with it, I cannot get it to produce the desired result. Could I have some help? Thank you!