forked from Abhijeet5665/c-programs-tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatrix.c
More file actions
43 lines (39 loc) · 671 Bytes
/
matrix.c
File metadata and controls
43 lines (39 loc) · 671 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<stdio.h>
void main(){
int n,m,i,j,k;
printf("enetr the rows and coloumn of 1st matrix\n");
scanf("%d%d",&n,&m);
int a[n][m];
printf("entre the elemnts\n");
for(i=0;i<n;i++){
for(j=0;j<m;j++)
scanf("%d",&a[i][j]);
}
int x,y;
printf("enetr the rows and coloumn of 2nd matrix\n");
scanf("%d%d",&x,&y);
int b[x][y];
printf("entre the elemnts\n");
for(i=0;i<x;i++){
for(j=0;j<y;j++)
scanf("%d",&b[i][j]);
}
int c[n][y];
for(i=0;i<n;i++){
for(j=0;j<y;j++){
c[i][j]=0;
for(i=0;i<n;i++){
for(j=0;j<y;j++){
for(k=0;k<m;k++)
c[i][j]+=a[i][k]*b[k][j];
}
}
}
}
printf("required matrix is\n");
for(i=0;i<n;i++){
for(j=0;j<y;j++)
printf("%d\t",c[i][j]);
printf("\n");
}
}