+ 11

How to print numbers horizontal using for loop

Program pleasec

1st May 2019, 8:51 AM
vamsi krishna
vamsi krishna - avatar
11 Respuestas
+ 13
If you want to print horizontally you can use \t it is used for horizontal tab or else you can simply leave space or else you can write %(number of space you want to leave)d for example %5d.
1st May 2019, 12:17 PM
Yamin Mansuri
Yamin Mansuri - avatar
+ 10
I think *AsterisK* you are right
1st May 2019, 2:55 PM
Yamin Mansuri
Yamin Mansuri - avatar
+ 8
In C: #include <stdio.h> int main() { for (int i = 0; i < 10; i++) { printf("%d ", i); } return 0; } --- In C++: #include <iostream> using namespace std; int main() { for (int i = 0; i < 10; i++) { cout << i << " " << flush; } return 0; } --- In Python: for i in range(0, 10): print(i, " ", end="")
1st May 2019, 9:09 AM
Edwin Pratt
Edwin Pratt - avatar
+ 8
please guys don't write code for users to let them show there try, this way you are not helping them, they will probably learn nothing because you have lift the weight for them so they gat no muscles
1st May 2019, 2:11 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 4
Logic : Concatenate the numbers into a string separated by spaces Loop from 0 to count - 1. This will work in any programming language ......😉
1st May 2019, 3:12 PM
Sanjay Kamath
Sanjay Kamath - avatar
+ 3
In java for(int i=1; i<=10; i++){ System.out.print(i+""); } Output: 1 2 3 4 5 7 8 9 10
2nd May 2019, 3:10 PM
Hamdan
Hamdan - avatar
+ 1
IN C: int i,n=10; for(i=0;i<n;i++){ printf("%d\n",I); } IN JAVA: int i,n; for(i=0;i<n;i++) System.out.println(i);
1st May 2019, 8:57 AM
mehran ghajari
0
In java for(int i=1; i<=11; i++){ System.out.print(“i”); } Output: 1 2 3 4 5 7 8 9 10
12th May 2019, 5:28 AM
Engr Abdulkarim Usman Ali Alrashidi
Engr Abdulkarim Usman Ali Alrashidi - avatar
0
ARE YOU GUYS KIDDING? NOT A SINGLE PROGRAM IS FOR PRINT NUMBERS IN SERIES...
29th Feb 2020, 5:26 AM
sdagaqg
0
to print out your output horizontally system.out.print not system.out.println removie ln :DDDDDDDDD
18th Dec 2021, 7:38 AM
Arwen Alviar
0
Arwen Alviar, you are a Saint!
30th Jan 2022, 1:54 PM
Kiril Kirilov