Show the following output using one loop.
1, 2, 3, 4, 5 6, 7, 8, 9, 10
Try to achieve the result by forcing the next iteration within the loop upon a specific condition, if your language allows it.
for(int i = 1;i <= 10; i++){ cout << i; if(i % 5 == 0){ cout << endl; continue; } cout << ", "; }
Content is available under GNU Free Documentation License 1.2.