+ 2
[Challenge] How will you print the following pattern in c++?
1 2 5 3 6 8 4 7 9 10 There must be a good logic in your code and it should be as short as possible.
6 Answers
+ 21
for(int a=1;a<=n;a++)
for(int b=1,d=a;b<=a;d+=n-b,b++)
System.out.print(d+(b!=a?" ":"\n"));
//works for general âș
+ 4
https://code.sololearn.com/cytSurrOBD4M/?ref=app
+ 3
https://code.sololearn.com/cZP831clM5Xb/?ref=app
+ 3
I think identical with @ Swapnil More. I don't peep;-)