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

25th Oct 2020, 5:22 PM
stephen haokip
stephen haokip - avatar
3 Answers
+ 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.
25th Oct 2020, 6:04 PM
Jayakrishna 🇼🇳
+ 1
This will atleast print that pattern. for(int i = 1; i<=5; i++){ System.out.print(i+" "+(i+5)); System.out.println(); }
25th Oct 2020, 5:27 PM
Avinesh
Avinesh - avatar
- 1
No avinash.. you have to print up down... Urs will print left to right..
25th Oct 2020, 5:29 PM
stephen haokip
stephen haokip - avatar