Cycle with 2 counters in Java [closed]

1

Is it valid to make a cycle like this one?

for(i=0,j=0;a[i][j]==0;i++,j++)

Would it increase both variables with each iteration performed?

    
asked by N.N. 12.08.2017 в 19:57
source

1 answer

0

You can do something like:

int j = 0;
for(int i=0;a[i][j]==0;i++){
//Código
j++;
}

Just remember to do j++ at the end of the cycle.

    
answered by 13.08.2017 / 04:15
source