Java how to write a simple code that prints out 0 1 2 3 , (next column) 1 2 3 4 , 2 3 4 5 , 3 4 5 6 , not using printout 4 times?


#1

Have a assignment but i’m new to java , would appreciate it if you guys can help with some explanation

all in different column
0,1,2,3
1,2,3,4
2,3,4,5
3,4,5,6


#2

each row the starting value increases by one, so you could use a nested for loop:

for (){
    for(){

    }
}

then the first for loop keep tracks of the rows, the second of the columns. By adding row value to column value, you should be able to achieve this


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.