# Matrix multiplication

My program is not giving the required outut but in dry run I am getting the correct output.
#include <stdio.h>
#include <stdlib.h>

void storeP(int m,int n)
{
int ar[10][10];
for(int i=0; i<m; i++)
{
for(int j=0; j<n; j++)
{
printf(“Enter the value at row %d and column %d\n”,i,j);
scanf("%d",&ar[i][j]);
}
}

``````printf("\n");

for(int i=0; i<m; i++)
{
for(int j=0; j<n; j++)
{
printf("%d  ",ar[i][j]);
}
printf("\n");
}
``````

}

int main()
{
int m1,n1;
int c=0;
printf(“Enter the number of rows you want in Matrix A:-- “);
scanf(”%d”,&m1);
printf(“Enter the number of column you want in Matrix A:–”);
scanf("%d",&n1);
int ma1[10][10];

``````int m2,n2;
printf("Enter the number of rows you want in Matrix B:-- ");
scanf("%d",&m2);
printf("Enter the number of column you want in Matrix B:--");
scanf("%d",&n2);
int ma2[10][10];

printf("Entering the value of rows and columns of matrix A\n");
storeP(m1,n1);
printf("Entering the value of rows and columns of matrix B\n");
storeP(m2,n2);
int ma3[10][10];

printf("\n\nFinding the product of Matrix A and B\n");

for(int i = 0; i <m1 ; ++i)
{
for(int j = 0; j <n2 ; ++j)
{
ma3[i][j] = 0;
}
}

for(int i=0; i<m1; i++)
{
for(int j=0; j<n2; j++)
{
for(int k=0; k<m2; k++)
{
ma3[i][j]+=(ma1[i][k]*ma2[k][j]);

}

}

}
printf("\n\n---The product matrix AB is:---\n\n");
for(int i=0; i<m1; i++)
{
for(int j=0; j<n2; j++)
{
printf("%d  ",ma3[i][j]);
}
printf("\n");
}
return 0;
``````

}