help me with multiplication of two matrix

whats wrong with this program?this program should take all of things in one scanf but its only takes matrix 1.i confused
#include<stdio.h>
int main() {
int h[2][2], g[2][1], s[2][1], i, j, sum = 0, m, n, o, p;
printf("Enter the row and column of first matrix\n");
scanf_s("%d %d", &m, &n);
printf("Enter the row and column of second matrix\n");
scanf_s("%d %d", &o, &p);
{
printf("Enter the First& Second matrix\n");
for (i = 0; i<m; i++)// h[i][j]
for (j = 0; j<n; j++)// h[i][j]
for (i = 0; i<o; i++)// g[i][j]
for (j = 0; j<p; j++)// g[i][j]
scanf_s("%d%d", &h[i][j],&g[i][j]);
printf("The First matrix is\n");
for (i = 0; i<m; i++) {
printf("\n");
for (j = 0; j<n; j++) {
printf("%d\t", h[i][j]);
}
}
printf("The Second matrix is\n");
for (i = 0; i<o; i++) {
printf("\n");
for (j = 0; j<p; j++) {
printf("%d\t", g[i][j]);
}
}
for (i = 0; i<m; i++)
for (j = 0; j<p; j++)
s[i][j] = 0;
for (i = 0; i<m; i++) { //row of first matrix
for (j = 0; j<p; j++) { //column of second matrix
sum = 0;
s[i][j] = sum;
}
}
}
printf("The multiplication of two matrix is\n");
for (i = 0; i<m; i++) {
printf("\n");
for (j = 0; j<p; j++) {
printf("%d\t",s[i][j]);
}
}
return 0;
}
What do you think a construct like this does?
1
2
3
4
for (i = 0; i<m; i++)// h[i][j]
for (j = 0; j<n; j++)// h[i][j]
for (i = 0; i<o; i++)// g[i][j]
for (j = 0; j<p; j++)// g[i][j] 


And
Please use code tags: [code]Your code[/code]
Read this: http://www.cplusplus.com/articles/z13hAqkS/
Topic archived. No new replies allowed.