Well...You don't say what values you get, but I'd suggest that place to start would be by resetting the value of your counter before you start summing the columns...
At the moment, you are just adding to
cs
continually!
for(r=0; r<rn; r++)
{
cs = 0; for(c=0; c<cn; c++)
{
cs=cs+a[r][c];
}
cout<<cs<<" ";
}
Then, when that works, add a second pair of loops which do the rows on the inside and the columns on the outside.