0
The for Loop C++
for (int a = 0; a < 10; a++) { cout << a << endl; } The output of this code prints out a range of numbers from 0 till 9 in a vertical syntax, my question is can we or is it possible to output the range in a horizontal syntax i.e // 0 1 2 3 4...9 unlike it been vertical i.e /* 0 if yes kindly someone show me how to please? 1 2 . 9 */
5 Answers
+ 7
Your answer is in the question itself.. try by removing endl as explained by đđ˘đ˘đđ¨ đđĄđđ˛đđĽ
+ 4
Code:
cout<<a<<" ";
Instead of:
cout<<a<<endl;
(Space b/w double quotation marks )
+ 3
Thanks for the help!