What they are asking to do it to print:
F
FE
FED
FEDC
FEDCB
FEDCBA
I was able to print:
F
FF
FFF
FFFF
FFFFF
with this code:
int main()
{
int count, count2;
char letterToPrint = 'F';
for (count = 0; count < 5; count++)
{
for (count2 = 0; count2 <= count; count2++)
{
printf("%c", letterToPrint);
}
printf("\n");
}
}
Is there something I can add in the second for loop to print the previous letter and then decrement it, or does this take another loop?
You just need to change the value of
letterToPrintin your inner loop and reset it at the start of the outer loop: