Page 330 - Computer science 868 Class 12
P. 330

43           void print()
                44           {

                45               int i,j;
                46               System.out.println("\nThe matrix is");

                47               for (i = 0; i < size; i++)
                48               {

                49                   for (j = 0; j < size; j++)
                50                   {
                51                       System.out.print(matrix[i][j] + "\t");

                52                   }

                53                   System.out.println();
                54               }
                55          }

                56
                57           void main()

                58           {
                59               input();

                60               print();
                61               displayOutput();

                62           }
                63       }


              The output of the preceding program is as follows:
              Enter the order of the matrix
              3
              Enter matrix elements
              1 2 3 4 5 6 7 8 9
              The matrix is
              1      2       3
              4      5       6
              7      8       9

              Pos            Sum            Product
              Row1           6             6
              Col1           12            28
              Row2           15            120
              Col2           15            80
              Row3           24            504
              Col3           18            162




                328328  Touchpad Computer Science-XII
   325   326   327   328   329   330   331   332   333   334   335