Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

#include <stdio.

h>
int main() {
int a[100][100], b[3][3], c[100][100], m, n;
scanf("%d %d",&m,&n);
for (int i=0; i<m; i++) {
for (int j=0;j<n;j++) {
scanf("%d",&a[i][j]);
}
}
for (int i=0; i<3; i++) {
for (int j=0;j<3;j++) {
scanf("%d",&b[i][j]);
}
}
for (int i=0;i<m-2; i++) {
for (int j=0;j<n-2;j++) {
c[i][j]=0;
for (int k=0;k<3;k++) {
for (int p=0; p<3;p++) {
c[i][j]=c[i][j]+ a[i+k][j+p]*b[k][p];
}
}
}
}
for (int i=0; i<m-2; i++) {
for (int j=0;j<n-2;j++) {
printf("%d ",c[i][j]);
}
printf("\n");
}
return 0;

You might also like