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.
4 Answers
+ 6
for(int i = 0; i < 9; i++){
for(int j = i; j < 10; j++){
//create your list from j to 9
}
}
+ 4
Isn't that the exact same question but up to 4 instead of 9? I may be missing your point
+ 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!!!
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?