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

JAVA 25.PNG

Advertisements