Multiply two Array matrix with the help of Program:- Q)Write a program to enter matrix(2) and print the multiplication of matrices. Not...
Multiply two Array matrix with the help of Program:-
Q)Write a program to enter matrix(2) and print the multiplication of matrices.
Note:-You can also create this program in c++(c plus plus),java,c#(c sharp) languages with the same logic.
Q)Write a program to enter matrix(2) and print the multiplication of matrices.
Note:-You can also create this program in c++(c plus plus),java,c#(c sharp) languages with the same logic.
void main()
{
int matrix1[10][20],matrix2[10][20],mul[20][30],i,j,row1,col1,row2,col2,s;
clrscr();
printf("Enter row and column");
scanf("%d%d",&row,&col);
printf("Enter first Matrix");
for(i=0;i<row1;i++)
{
for(j=0;j<col1;j++)
{
scanf("%d",&matrix1[i][j]);
}
}
printf("Enter second Matrix");
for(i=0;i<row2;i++)
{
for(j=0;j<col2;j++)
{
scanf("%d",&matrix2[i][j]);
}}
if(col1==row2)
{
for(i=0;i<row1;i++)
{
for(j=0;j<col2;j++)
{
s=0;
for(k=0;k<col1;k++)
{
s=s+matrix1[i][j]+matrix2[i][j];
mul[i][j]=s;
}}
printf("Matrix is");
for(i=0;i<row1;i++)
{
for(j=0;j<col2;j++)
{
printf("%d",mul[i][j]);
}
printf("\n");
}}
else
printf(No Result");
}
If you have any query then leave your comments and don't forgot to follow me on Google+,Facebook,Twitter.
COMMENTS