I feel like I'm so close but I'm missing something. currently stumped any help?
public class Feb15HWQ2{
public static void main(String args[])
{
int A [] = {1,2,3,4,5,6,7,8,9};
int B [][] = new int [3][3];
int i=0,k,j;
for(k=0;k<3;k++)
for(j=0;j<3;j++)
{
B[k][j] = A[k*3 + j];
k++;
}
for(k=0;k<3;k++)
{
for(j=0;j<3;j++)
System.out.print(B[k][j]+" ");
System.out.println();
}
}
}
Current output:
1 0 0
0 5 0
0 0 9
Output I need:
1 2 3
4 5 6
7 8 9