Might be just the opposite result...but not hard to fix.
void CreateMatrix(int maxrow,int maxcol)
for (int row=0;row<maxrow;row++)
for (int col=0;col<maxcol;col++)
if (row<halfy || col<halfx)
if (row>halfx || col>halfy)
..print out however you want
This should leave one of the matrix axes untouched leaving all zeros since it has been zeroed.
If you want to do it in a while loop...you should be able to figure that out as well.
For a single loop unroll the inner loop and access the matrix by using (row*maxcol)+col.