+ 11
How to print numbers horizontal using for loop
Program pleasec
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.
+ 10
I think *AsterisK* you are right
+ 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="")
+ 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
+ 4
Logic : Concatenate the numbers into a string separated by spaces
Loop from 0 to count - 1. This will work in any programming language ......😉
+ 3
In java
for(int i=1; i<=10; i++){
System.out.print(i+"");
}
Output:
1 2 3 4 5 7 8 9 10
+ 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);
0
In java
for(int i=1; i<=11; i++){
System.out.print(“i”);
}
Output:
1 2 3 4 5 7 8 9 10
0
ARE YOU GUYS KIDDING? NOT A SINGLE PROGRAM IS FOR PRINT NUMBERS IN SERIES...
0
to print out your output horizontally
system.out.print
not system.out.println
removie ln :DDDDDDDDD
0
Arwen Alviar,
you are a Saint!