-
Notifications
You must be signed in to change notification settings - Fork 0
/
2DMUL.BAK
52 lines (49 loc) · 983 Bytes
/
2DMUL.BAK
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
51
52
#include<stdio.h>
#include<conio.h>
int main(){
int a,b,A[100][100],B[100][100],i,j,k,sum=0,C[100][100];
int r1,c1,r2,c2;
clrscr();
printf("Enter the rows and colums of array1\n");
scanf("%d %d",&r1,&c1);
printf("Enter the rows and colums of array2\n");
scanf("%d %d",&r2,&c2);
if(r1==c2||r2==c1){
for(a=0;a<r1;a++){
for(b=0;b<c1;b++){
printf("ARR1[%d][%d] =",a,b);
scanf("%d",&A[a][b]);
}
}
a=0;b=0;
for(a=0;a<r1;a++){
for(b=0;b<c1;b++){
printf("ARR2[%d][%d] =",a,b);
scanf("%d",&B[a][b]);
}
}
a=0;b=0;
for(i=0;i<r1;i++){
for(j=0;j<r1;j++){
for(k=0;k<r1;k++){
sum = sum+A[i][k]*B[k][j];
}
C[i][j] = sum+A[i][k]*B[k][j];
printf("%d \t",sum);
sum = 0;
}
printf("\n");
}
for(a=0;a<r1;a++){
for(b=0;b<c1;b++){
printf("ARR[%d][%d] = %d \t",a,b,C[a][b]);
}
printf("\n");
}
}
else{
printf("Answer can't be generated!!");
}
getch();
return 0 ;
}