Page 578 - ComputerScience_Class_11
P. 578

62                   {
                63                       System.out.print(ar[i][j]+"\t");

                64                   }
                65                   System.out.println();
                66               }

                67           }

                68
                69           public static void main(String args[])
                70           {//start of main

                71               rowcolsum ob = new rowcolsum();
                72               ob.input();

                73               ob.display();
                74               ob.row_sum();

                75               ob.col_sum();
                76           }//end of main

                77       }//end of class

              The output of the preceding program is as follows:
                     BlueJ: Terminal Window - Java

                 Options

                Number of rows : 3
                Number of columns : 3
                Enter the element in the array : 1
                Enter the element in the array : 2
                Enter the element in the array : 3
                Enter the element in the array : 4
                Enter the element in the array : 5
                Enter the element in the array : 6
                Enter the element in the array : 7
                Enter the element in the array : 8
                Enter the element in the array : 9
                1   2   3
                4   5   6
                7   8   9


                The sum of row : 0 : 6
                The sum of row : 1 : 15
                The sum of row : 2 : 24
                The sum of column : 0 : 12
                The sum of column : 1 : 15
                The sum of column : 2 : 18






                  576  Touchpad Computer Science (Ver. 3.0)-XI
   573   574   575   576   577   578   579   580   581   582   583