-
For Loop in C
Hello every one , i want to do an For loop for this console output.
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
And i want have something like this.
0 1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
2 3 4 5 6 7 8 9 10
3 4 5 6 7 8 9 10
4 5 6 7 8 9 10
5 6 7 8 9 10
6 7 8 9 10
7 8 9 10
8 9 10
9 10
10
It need to have 2 For Loops.
Can someone script me that in C?.
I'm new in programming and i dont know how that work.
Thx.
-
Forum Guidelines
We are here to help people who are having specific problems with programming, not to do their work for them.
You need to make an attempt at figuring this out yourself. If you get stuck, post your code (using code tags) along with specific questions about where you need help.
-
-
I'll give you some very general tips.
Your going to need two loops, one outer loop and one inner loop. Both continuation conditions are going to have to either increment to ten or decrement to zero. I would use a FOR loop for this, as while and do-while can be a little harder to implement. Don't forget to print the newline.