0

Good day!
can you guys help me
to have the code for this output? pleasee..

_ _ _ 1
_ _ 2 2
_ 3 3 3
4 4 4 4

thanks in advance!

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

Thanks for the help
but I need the nested loops...

1
for (int i = 0; i < 1; ++i) {
    for (int j = 0; j < 1; ++j) {
        cout<<"_ _ _ 1" << endl;
        cout<<"_ _ 2 2" << endl;
        cout<<"_ 3 3 3" << endl;
        cout<<"4 4 4 4" << endl;
    }
}
Votes + Comments
Haha :)
0

thanks for the help
but it doesn't work...
i need a loop for the new space
another loop for the underscore (_)
and a loop for the numbers...
it compose 3 loops
a loops within a loop..

0

Okay, so you've started to plan out what you need, that's a good thing. Start trying to code it.
-Can you make the numbers increase over each row.
-Do the counts of the elements in the rows bear any relation to other variables?

Plan out what you want with pencil and paper and then try to translate it into code.

0
for (int i = 0; i < 100000000; ++i) {
    for (int j = 0; j < 100000000; ++j) {
       for (int k = 0; k < 100000000; ++k) {
        cout<<"_ _ _ 1" << endl;
        cout<<"_ _ 2 2" << endl;
        cout<<"_ 3 3 3" << endl;
        cout<<"4 4 4 4" << endl;
        }
    }
}

That should do the trick, it might take a while but the end result will work. Just wait

Edited by Akill10: n/a

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.