Multiply 2 Matrices
      Multiplying 2 matrices is done the same way as normal matrix multiplication. First we need to confirm that the number of columns in the first array is equal to the number of rows in the second array.
/*
	http://www.ProbCOMP.com
	
	Multiplying 2 matrices is done the same way as normal matrix multiplication. First we need to confirm that the number of columns in the first array
	is equal to the number of rows in the second array.


*/

#include<stdio.h>

void display(int arr[2][3])
{
	for(int i=0;i<2;i++)
	{
		for(int j=0;j<3;j++)
		{
				printf("%d ",arr[i][j]);
		}
		printf("\n");
	}
}

void main()
{
	int arr1[2][3]={{2,3,4},{4,5,6}};
	int arr2[3][3]={{1,1,1},{1,1,1},{1,1,1}},arr3[2][3]={0};
	int row1=2,col1=3,row2=3,col2=3;
	//Number of columns of first array should be equal to seacond arrays rows for valid multiplication
	
	for(int i=0;i<row1;i++)
	{
		for(int j=0;j<col2;j++)
		{
			for(int k=0;k<row2;k++)
			{
				arr3[i][j]=arr3[i][j]+arr1[i][k]*arr2[k][j];
			}
		}
	}
	
	printf("\nresult of multiplication\n" );
	display(arr3);
	
}									

Download Program
Did You Know ?
IP address is a numerical label that is assigned to devices participating in a computer network. Read More