Assume there is a triangle shape as..
(0,0)
(1,0) (1,1)
(2,0) (2,1) (2,2)
(3,0) (3,1) (3,2) (3,3)
(4,0) (4,1) (4,2) (4,3) (4,4)
So If I receive integers like
1 2 3
I want to store as 1 as
row[0] = 0;
col[0] = 0;
and 2 as
row[1] = 1;
col[1] = 0;
3 as follow.
row[2] = 1;
col[2] = 1;
public class Test {
public static void main(String[] args) {
int i, j;
for(i = 0; i < 5; i++) {
for(j = 0; j <= i; j++)
System.out.printf("(%d,%d)", i, j);
System.out.println();
}
}
}