0

create a list of numbers that removes the first digit each time

how would you create a list of numbers in Java from 0 to 9 which eliminate the first digit in each new line, for example first line would be 0,1,2...9 second line 1,2,3... third line 2,3,4.. etc.

17th Oct 2017, 4:57 AM
Alvaro Gonzalez
Alvaro Gonzalez - avatar
4 odpowiedzi
+ 6
for(int i = 0; i < 9; i++){ for(int j = i; j < 10; j++){ //create your list from j to 9 } }
17th Oct 2017, 5:00 AM
Dapper Mink
Dapper Mink - avatar
+ 4
Isn't that the exact same question but up to 4 instead of 9? I may be missing your point
17th Oct 2017, 5:11 AM
Dapper Mink
Dapper Mink - avatar
+ 1
oh sorry I wasn't clear, I actually found the way I want it sort it out: public static void main(String[] args) {         for(int i = 0; i < 10; i++){         System.out.println();   for(int j = i; j < 10; j++)   {     System.out.print(j);        } so pretty much I wanted to display the result as: 0,1,2,3,4,5... 1,2,3,4,5... 2,3,4,5,... instead of  0,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,2,3-4,5... but with your code I was able to figure it out, so thanks so much!!!
17th Oct 2017, 5:32 AM
Alvaro Gonzalez
Alvaro Gonzalez - avatar
0
wow that was fast, thanks so much, just by any chance do you know how can I make it sort it like 0,1,2,3,4 like an horizontal line and the next one 1,2,3,4.. and so on as well?
17th Oct 2017, 5:09 AM
Alvaro Gonzalez
Alvaro Gonzalez - avatar