can you show me the code..just now i have programming class in my university..i sat on the back..so i didnt notice anything about this nested loop section..and plus im blurred..
so can you help me for this output..i mean..can you help me with the code..maybe with that i can learn it
Alright. =)
I don't mind helping people figure stuff out, but I don't like to hand out solutions, either. "Teach a man to fish", etc, etc.
You have the nested loop idea right, but it would probably help to split the job up into several parts. This is how I would approach the problem:
1 2 3 4 5 6 7 8 9 10
for(row = 1; row <= num; ++row)
{
// have a loop here which draws the appropriate number of spaces
// have another loop here which prints 1 up to the current row number (row)
// have a 3rd loop here which prints numbers counting down from 'row'
printf("\n");
}
Notice that all the inner rows all follow a pattern. They all start with some spaces, print a number, have some more spaces, then print that number again. Figure out the pattern, then it should be easy to translate it into code.