Facebook
From Md. Afif Mumtahin, 1 Year ago, written in C.
Embed
Download Paste or View Raw
Hits: 120
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.         int row, col, n, mat1[10][10], r, c, mat2[10][10], mat3[10][10];
  6.         printf("Enter order for both matrix : ");
  7.         scanf("%d %d", &row, &col);
  8.         for(r=0; r<row; r++)
  9.         {
  10.                 for(c=0; c<col; c++)
  11.                         scanf("%d", &mat1[r][c]);
  12.         }
  13.         printf("\n");
  14.         for(r=0; r<row; r++)
  15.         {
  16.                 for(c=0; c<col; c++)
  17.                 scanf("%d", &mat2[r][c]);
  18.         }
  19.         printf("\n");
  20.         for(r=0; r<row; r++)
  21.         {
  22.                 for(c=0; c<col; c++)
  23.                         mat3[r][c] = mat1[r][c] + mat2[r][c];
  24.         }
  25.         printf("Summation of matrix : \n");
  26.         for(r=0; r<row; r++)
  27.         {
  28.                 for(c=0; c<col; c++)
  29.                         printf("%d ", mat3[r][c]);
  30.                 printf("\n");
  31.         }
  32.        
  33.         return 0;
  34. }