0

please help me to get the code of this output:
1
2 3 2
3 4 5 4 3
4 5 6 7 6 5 4
5 6 7 8 9 8 7 6 5
6 7 8 9 0 1 0 9 8 7 6
7 8 9 0 1 2 3 2 1 0 9 8 7
8 9 0 1 2 3 4 5 4 3 2 1 0 9 8
9 0 1 2 3 4 5 6 7 6 5 4 3 2 1 0 9
0 1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1 0

NOTE: i must use nested loops.
Do not write out 10 multi digit strings.....

5
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by ScottieF
0

Break the pattern down.

Linearly :

some numbers | middle number| some number reversed

1 
2 |3| 2  
3 4 |5| 4 3
4 5 6 |7| 6 5 4
5 6 7 8 |9| 8 7 6 5
6 7 8 9 0 |1| 0 9 8 7 6
7 8 9 0 1 2 |3| 2 1 0 9 8 7 
8 9 0 1 2 3 4 |5| 4 3 2 1 0 9 8
9 0 1 2 3 4 5 6 |7| 6 5 4 3 2 1 0 9
0 1 2 3 4 5 6 7 8 |9| 8 7 6 5 4 3 2 1 0
0

Can anyone tell me brief about this game..?plz
<FAKE SIGNATURE>

Edited by peter_budo: Keep It On The Site - Do not manually post &quot;fake&quot; signatures in your posts.

0

okie dokie I just did this program and I'll tell you a little bit about the code to get you started. I can't really give you the sudo code because then it would be ultra obvious and easy for you to copy lol. But if you can show some progress with what I give you here I'll give you more help if you need. OK HERE WE GO:

I used 3 for variables i, j, and k
I used 3 for loops in this format
for(i = 1; i <= 10; i++){
for()
//one additional line of code here out side of the 2 inner for loops
for()
cout << endl;
}

So the first for() that encapsulates the other 2 runs 10 times and goes from 1-10 (if you notice you will see that the left hand side of the numbers go from 1 down to 10 [the last number is 0 which here is a big hint is 10%10 so all of your cout << statements should have %10 on them so that none of the numbers are bigger than 10])

2nd to last hint is the first inner for loop gives the first half of the numbers in each the line. The mystery comment line I put in between the 2 loops is the center number and the last loop is the other half of the values.

last hint which is pretty jumbo is you will notice that half of the length of each line that is printed NOT including the center value is:
((the first value of the line)*2-1)/2 k wait here is the last hint in the first for loop I gave you remember that the i value of the is the first value of every line.

PS: when I take out all the spaces in between lines my code is only 15 lines to do this program so its not long at all just gotta think about the loops. All you need to include is iostream and you're good. good luck proggin cya.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.