write the program to find multiplication of 2-D matrix??????????

Answer Posted / keshave12

#include<stdio.h>
void main()
{
int a[10][10],b[10][10],c[10][10],i,j,c1,r1,c2,r2,ir2;
printf("enter the row and column of 1st matrix");
scanf("%d%d",&r1,&c1);
printf("enter the row and column of 2nd matrix");
scanf("%d%d",&r2,&c2);
if(c1==r2)
printf("multiplication can be done");
printf("enter the element of 1st matrix");
for(i=0;i<r1;i++)
for(j=0;j<c1;j++)
scanf("%d",&a[i][j]);
printf("enter the element of 2nd matrix");
for(i=0;i<r2;i++)
for(j=0;j<c2;j++)
scanf("%d",&b[i][j]);
for(i=0;i<c1;i++)
for(j=0;j<r2;j++)
{
c[i][j]=0;
for(ir2=0;ir2<c1;ir2++)
c[i][j]=a[i][ir2]*[ir2][j];
}
printf("the multiplication of two matrices is:\n");
for(i=0;i<c1;i++)
for(j=0;j<r2;j++)
printf("%3d",c[i][j]);
printf("\n");
getch();
}

Is This Answer Correct ?    10 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is #include stdlib h?

847


‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.

2074


How can you draw circles in C?

826


What does void main return?

825


Explain pointer. What are function pointers in C?

817


What is the purpose of main( ) in c language?

861


What is preprocessor with example?

774


Explain how do you override a defined macro?

795


Define Array of pointers.

823


What is meant by realloc()?

882


In C programming, how do you insert quote characters (‘ and “) into the output screen?

1213


What are the features of the c language?

835


Explain what is the general form of a c program?

806


Explain what are its uses in c programming?

785


What is a pragma?

866