C
c
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
#include <stdio.h>
#define MAX 50
int main() {
int a [MAX][MAX],b[MAX][MAX],product[MAX][MAX];
int arows,acolumns,brows,bcolumns;
int i,j,k;
int sum=0;
printf ("Enter the rows and columns of matrix a:\n"); //Part 1
scanf("%d%d",&arows,&acolumns);
printf ("Enter the elements of matrix a:\n");
for(i=0;i<arows;i++)
{
for(j=0;j<acolumns;j++)
{
scanf ("%d",&a[i][j]);
}
}
printf ("Enter the rows and columns of matrix b:\n");
scanf ("%d%d",&brows,&bcolumns);
if(brows!=acolumns)
printf ("Sorry! We cannot matrices a and b");
else
printf ("Enter the elements of matrix b:\n");
for(i=0;i<brows;i++)
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run