+ 1

how can i write 1 times 1, 2 times 2 , 3 times 3 in page with for loop? for example (1223334444)

8th Sep 2017, 8:48 AM
Oğuz GĂŒven
Oğuz GĂŒven - avatar
2 Answers
+ 3
C# LINQ One-Liner〰 Enumerable.Range(1, 4) .SelectMany(n => Enumerable.Repeat(n, n)).ToList() .ForEach(n => Console.Write(n)); 💡 Demo https://code.sololearn.com/cP12vDMgTn9E/?ref=app
8th Sep 2017, 11:47 AM
Zephyr Koo
Zephyr Koo - avatar
+ 3
for(unsigned i = 1; i < n; ++i) for(unsigned j = 0; j < i; ++j) cout << i;
8th Sep 2017, 9:08 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar