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

FILE PROGRAMMING

1769


Write a code to generate divisors of an integer?

626


Explain the properties of union.

602


What is pointer to pointer in c?

626


How do I determine whether a character is numeric, alphabetic, and so on?

614






What is call by value in c?

547


Explain that why C is procedural?

648


The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?

755


When would you use a pointer to a function?

578


What is the size of a union variable?

589


How to explain the final year project as a fresher please answer with sample project

459


Which are low level languages?

618


What is the difference between union and structure in c?

562


What is the use of sizeof () in c?

547


How do c compilers work?

600