Docsity

introduction to matrices, Summaries of Mathematics

Toggle sidebar
bg1
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

Partial preview of the text

Download introduction to matrices and more Summaries Mathematics in PDF only on Docsity!

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