hello everyone,
I am trying to achieve a nested loop to post the following on the prompt:
1
2 4
1 3 5
2 4 6 8
1 3 5 7 9
2 4 6 8 10 12
I have been told I must use a modulus to achieve this but I am struggling.
I must use the following format, for e.g I completed this code:
Code:to achieve this:Code:for(i = 9; i >= 1; i-=2) { for(j = 1; j <= i; j+=2) { printf("%hd " , j); } printf("\n"); }
1 3 5 7 9
1 3 5 7
1 3 5
1 3
1
so I am unsure where to add the modulus to to the other nested loop, any help would be appreciated.