0
Since yesterday i was writing a code
For printing a number 1 to 10 vertically(up down). Something like this- 1 6 2 7 3 8 4 9 5 10 I succeeded in printing horizontally(left to right). Plis any suggestion is appreciated. https://code.sololearn.com/cKPg4mdhwQbJ/?ref=app
3 Antworten
+ 1
int n = 50; //take input
for(int i = 1; i<=n; i++){
System.out.print(" "+i+" "+(i+n));
System.out.println("");}
Edit :oh..What is wrong with @Avinesh code?It's same as mine.
+ 1
This will atleast print that pattern.
for(int i = 1; i<=5; i++){
System.out.print(i+" "+(i+5));
System.out.println();
}
- 1
No avinash.. you have to print up down...
Urs will print left to right..