SUBTRACTION OF MATRIX


 MATRIX 

  • SUBTRACTION OF TWO MATRIX.

  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.    int m, n, c, d, first[10][10], second[10][10], sub[10][10];
  6.  
  7.    printf("Enter the number of rows and columns of matrix\n");
  8.    scanf("%d%d", &m, &n);
  9.    printf("Enter the elements of first matrix\n");
  10.  
  11.    for (= 0; c < m; c++)
  12.       for (= 0; d < n; d++)
  13.          scanf("%d", &first[c][d]);
  14.  
  15.    printf("Enter the elements of second matrix\n");
  16.  
  17.    for (= 0; c < m; c++)
  18.       for (= 0 ; d < n; d++)
  19.          scanf("%d", &second[c][d]);
  20.    
  21.    printf("Sub of entered matrices:-\n");
  22.    
  23.    for (= 0; c < m; c++) {
  24.       for (= 0 ; d < n; d++) {
  25.          sub[c][d] = first[c][d] -second[c][d];
  26.          printf("%d\t", sub[c][d]);
  27.       }
  28.       printf("\n");
  29.    }
  30.  
  31.    return 0;
  32. }

No comments:

Post a Comment

If you have any problems related to solutions or any concept please let me know.

Copyright (c) 2020 Custom Programs All Right Reserved

Pages