-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproduct.c
More file actions
50 lines (49 loc) · 778 Bytes
/
product.c
File metadata and controls
50 lines (49 loc) · 778 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
42
43
44
45
46
47
48
49
50
#include<stdio.h>
int main()
{
int n,m,k;
printf("enter no of rows");
scanf("%d",&n);
printf("enter no of cols");
scanf("%d",&m);
printf("enter no of cols");
scanf("%d",&k);
int a[n][m];
int b[m][k];
for(int i = 0;i<n;i++)
{
for(int j = 0;j<m;j++)
{
printf("enter the %d-row %d-col element: ",i+1,j+1);
scanf("%d",&a[i][j]);
}
}
for(int i = 0;i<m;i++)
{
for(int j = 0;j<k;j++)
{
printf("enter the %d-row %d-col element: ",i+1,j+1);
scanf("%d",&b[i][j]);
}
}
int p[n][k];
for(int i = 0 ;i<n;i++)
{
for(int j = 0;j<m;i++)
{
p[i][j] = 0;
for(int l = 0;l<k;l++)
{
p[i][j] = p[i][j] + a[i][l]* b[l][j];
}
}
}
for(int i = 0;i<n;i++)
{
for(int l = 0;l<5;l++)
{
printf("%d\t",p[i][l]);
}
printf("\n");
}
}