Sum addition of two matrix


#include <stdio.h>


int main()

{
   int m, n, c, d, first[20][20], second[20][20], sum[20][20];

   printf("Enter the number of rows and columns of the matrix \n");

   scanf("%d%d", &m, &n);

   printf("Enter the elements of the first matrix\n");


   for (c = 0; c < m; c++)

      for (d = 0; d < n; d++)

         scanf("%d", &first[c][d]);


   printf("Enter the elements of the second matrix\n");


   for (c = 0; c < m; c++)

      for (d = 0 ; d < n; d++)

         scanf("%d", &second[c][d]);


   printf("Sum of the entered matrices is :-\n");


   for (c = 0; c < m; c++)

    {
      for (d = 0 ; d < n; d++)
      {
         sum[c][d] = first[c][d] + second[c][d];
         printf("%d\t", sum[c][d]);
      }
      printf("\n");
   }

   return 0;

}

OUTPUT :-





For Other Programs Visit The WebSite:-   https://www.techapurba.com/

Follow Me On Social Media :-






For tech related videos visit my other website :- https://apurbatechinfo.blogspot.com/

Post a Comment

0 Comments