- 2

For loop example

I need to do this with using for loops, enter a number: 4 1 22 333 4444 333 22 1 how can I do this?

8th Nov 2017, 9:26 PM
Mustafa K.
Mustafa K. - avatar
6 Answers
+ 7
Hint: use a pair of nested loops. eg for() { for () { //output here } }
8th Nov 2017, 9:32 PM
jay
jay - avatar
+ 4
1) Is this homework? 2) Have you tried it yourself? 3) What language should this be in (Java, Python, C++, etc.)?
8th Nov 2017, 9:29 PM
LunarCoffee
LunarCoffee - avatar
+ 3
Or if you're using Python (or ruby, maybe? (I'm not sure)), remember you can multiply strings by integers to make them appear however many times.
8th Nov 2017, 9:36 PM
LunarCoffee
LunarCoffee - avatar
9th Nov 2017, 3:56 AM
LunarCoffee
LunarCoffee - avatar
+ 1
I am using c++. I saw that example while Im surfing on the internet. I tried to do it but I couldn't so I asked how can I do it.
9th Nov 2017, 3:29 AM
Mustafa K.
Mustafa K. - avatar
+ 1
Thanks
9th Nov 2017, 4:03 AM
Mustafa K.
Mustafa K. - avatar