Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

introduction to matrices, Summaries of Mathematics

introduction to matrices introduction to matrices

Typology: Summaries

2023/2024

Uploaded on 04/08/2025

john-macharia-1
john-macharia-1 🇬🇧

1 document

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

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