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



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

Answer / 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

More C Interview Questions

control 50 devices which has 2 states on and off.using bitwise operator.plz answer it its urgent

1 Answers  


what is printf

5 Answers   MVSR, Satyam,


what is use of malloc and calloc?

0 Answers  


Determine the result of performing two successive block transfers into the same area of a frame buffer using the binary arith operations

0 Answers  


main() { enum _tag{ left=10, right, front=100, back}; printf("%d, %d, %d, %d", left, right, front, back); }

1 Answers   Accenture, Vector,






print the palindrome numbers in between 0 to n

1 Answers  


Explain what’s a signal? Explain what do I use signals for?

0 Answers  


Design a program using an array that searches a number if it is found on the list of the given input numbers and locate its exact location in the list.

4 Answers  


What is meant by inheritance?

0 Answers  


write a program to copy the string using switch case?

0 Answers   Mind Tree,


How we can insert comments in a c program?

0 Answers  


How do I declare a pointer to an array?

6 Answers   IBM,


Categories