class SumColumn
{
                public static void main(String args[])
                {
                                int i,j,s=0;
                                int n[][]={{1,2,3,4},{5,6,7,8},{9,10,11,12}};
                                for(i=0;i<4;i++)
                                {
                                                s=0;
                                                for(j=0;j<3;j++)
                                                                s+=n[j][i];
                                                System.out.println((i+1)+" Column Sum : "+s);
                                }
                }
}

JAVA 26

Advertisements