Page 328 - Computer science 868 Class 12
P. 328

Enter values for matrix A:
              1
              1
              2
              3
              4
              5
              Enter values for matrix B:
              3
              4
              4
              5
              6
              6
              Matrix multiplication is:
              The product is:
              19 21
              55 62


                Program 10     Write a program to find the sum and product of elements in a row/column.
                               Given a square matrix, print the sum and product of the elements in each row and column.
                               Example:
                               Matrix:
                               1  2  3  4
                               5  6  7  8
                               9  10  11  12
                               13  14  15  16
                               Pos      Sum      Product
                               r1       10       24
                               c1       28        585
                               r2       26        1680
                               c2       32        1680
                               r3       42        11880
                               c3       36        3465
                               r4       58        43680
                               c4       40        6144

                 1       import java.util.*;
                 2       class SumProduct

                 3       {
                 4           int matrix[][];

                 5           int size;
                 6           void displayOutput()

                 7           {



                326326  Touchpad Computer Science-XII
   323   324   325   326   327   328   329   330   331   332   333