# Numerical Methods Multiplication of two matrices using two dimensional array in CC

Numerical Methods: Multiplication of two matrices using two dimensional array in C/C++

Source Code

```#include

int main()
{
int r1, c1, r2, c2, matrix1[10][10], matrix2[10][10], result[10][10];
int i, j, k;
printf("Enter the row and column of the first matrix: ");
scanf("%d%d",&r1,&c1);
printf("Enter the row and column of the second matrix: ");
scanf("%d%d",&r2,&c2);
if(c1 != r2){
printf("Matrix multiplication impossible");
}

printf("Enter the first matrix: \n");
for(i = 0; i
for(j = 0; j < c1; j++)
scanf("%d", &matrix1[i][j]);

printf("Enter the second matrix: \n");
for(i = 0; i
for(j = 0; j < c2; j++)
scanf("%d", &matrix2[i][j]);

for(i = 0; i < r1; i++ ){
for(j = 0; j < c2; j++){
result[i][j] = 0;
for(k = 0; k < c1; k++){
result[i][j] += matrix1[i][k] * matrix2[k][j];
}
}
}

printf("The multiplication of the matrix is: \n");

for(i = 0; i < r1; i++){
for(j = 0; j < c2; j++){
printf("%d", result[i][j]);
printf(" ");
}
printf("\n");
}
return 0;
}

Related PostsJuly 12, 2012 Sum of two matrices using two dimensional array in CAugust 11, 2012 Numerical Methods Condition number and ill condition checking using CAugust 4, 2012 Numerical Methods Determinant of nxn matrix using CAugust 5, 2012 Numerical Methods Inverse of nxn matrix using CAugust 6, 2012 Numerical Methods Parabolic curve fitting using CZemanta

```