
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

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