Page 463 - computer science (868) class 11
P. 463

78                      for(j=0;j< n;j++)
                   79                      {

                   80                          if(i==0 || j==0 || i==m-1 || j==n-1)
                   81                          {

                   82                              s=s+a[i][j];
                   83                              System.out.print(a[i][j]+" ");

                   84                          }
                   85                          else

                   86                          {
                   87                              System.out.print("  ");

                   88                          }
                   89                      }
                   90                      System.out.println();

                   91                  }

                   92                  System.out.println("SUM OF OUTER ROW AND OUTER COLUMN ="+s);
                   93              }
                   94          }//end of main

                   95      }//end of class

                 The output of the preceding program is as follows:
                 Enter the number of rows and columns(>2 and <20):
                 3
                 3
                 Enter 9 elements for the matrix:
                 11
                 22
                 33
                 44
                 55
                 66
                 77
                 88
                 99

                 Original Matrix:
                 11 22 33
                 44 55 66
                 77 88 99
                 REARRANGED MATRIX:
                 11 22 33
                 99 55 44
                 88 77 66




                                                                                                                       461
                                                                                                   Internal Assessment  461
   458   459   460   461   462   463   464   465   466   467   468