Advertisement
semsem_elazazy

Untitled

Dec 24th, 2021
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.05 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6.       int a[10][10],b[10][10],m,n,o,p,i,j;
  7.     printf("\nEnter the row and column of first matrix");
  8.     scanf("%d %d",&m,&n);
  9.     printf("\nEnter the row and column of second matrix");
  10.     scanf("%d %d",&o,&p);
  11.     printf("\nEnter the First matrix->");
  12.     for(i=0;i<m;i++){
  13.     for(j=0;j<n;j++){
  14.     scanf("%d",&a[i][j]);}}
  15.     printf("\nEnter the Second matrix->");
  16.    
  17.     for(i=0;i<o;i++){
  18.     for(j=0;j<p;j++){
  19.     scanf("%d",&b[i][j]);}}
  20.  
  21.  printf("\nThe First matrix is\n");
  22.  for(i=0;i<m;i++){
  23.  printf("\n");
  24.  for(j=0;j<n;j++){
  25.  printf("%d\t",a[i][j]);
  26.  }
  27.  }
  28. printf("\nThe Second matrix is\n");
  29.  for(i=0;i<o;i++){
  30.  printf("\n");
  31.  for(j=0;j<p;j++){
  32.  printf("%d\t",b[i][j]);
  33.  }
  34.  }
  35.  printf("\n The sum of two matrix is  \n");
  36.  for (i=0 ; i<m ; i++)
  37.  {
  38.      printf("\n");
  39.      for (j=0 ; j<n ;j++)
  40.      {
  41.          int sum=0 ;
  42.          sum = a[i][j] + b[i][j];
  43.          printf("%d    ",sum);
  44.          }
  45.          }
  46.  
  47.  
  48.   system("PAUSE"); 
  49.   return 0;
  50. }
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement