Hello people i got a h.w to do Using nested loops to produce the following pattern:
F
FE
FED
FEDC
FEDCB
FEDCBA
I had idea to do it but that will require array and strlen(char first int of the outer loop) and the thing says that I must do it with char only
but here my code i made problem is that it need to intilise c='F' then its bigger than or = 'A' and i decrement it so it shows from F to A problem that there wont be any thing to intilise the inner loop to the outer integer or that may seem true to me maybe its wrong since i dont have much programming experience and i alawys sucks in nested loop anyways here code now
#include <stdio.h>
int main(void)
{
int i,x;
char c;
for(i=0;i<6;i++) {
for(c='F',x=i;c>='A' && x<=i;c-- , x++) {
printf("%c ",c);
}
puts("");
}
return getchar();
}
as i think in inner loop i intilise c to f then c is bigger or = to a then i make x<=i whish will like first time 1 2 etc but shouldnt that also print
F then FE etc ? since x will be incremeted each time ?