-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjik.cpp
More file actions
33 lines (30 loc) · 750 Bytes
/
jik.cpp
File metadata and controls
33 lines (30 loc) · 750 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
#include <stdio.h>
int main()
{
//int row, col, col1=3;
int A [3][3] ={{1,2,3},{4,5,6},{7,8,9}};
int B [3][3] ={{1,2,3},{4,5,6},{7,8,9}};
int C [3][3] ={{0,0,0},{0,0,0},{0,0,0}};
for (int j=0; j<3; j++){
printf("j= %d", j);printf("\n");
for (int i=0; i<3; i++){
printf("i= %d", i);printf("\n");
int temp = 0;
printf("temp= %d", temp);printf("\n");
for (int k=0; k<3; k++){
printf("k= %d", k);printf("\n");
temp += A[i][k] * B[k][j]; //C is fixed while A is rowWise and B is columnWise
C[i][j]=temp; //C is updated columnwise
printf("Cij= %d", temp);printf("\n");
}
}
}
for (int i=0; i<3; i++){
for (int j=0; j<3; j++)
{
printf("%d\t", C[i][j]);
}
printf("\n");
}
return 0;
}