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

Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?

0 Answers  


number of times a digit is present in a number

0 Answers  


Is null always defined as 0(zero)?

0 Answers  


without using arithmatic operator solve which number is greater??????????

1 Answers   Accenture,


What is structure padding in c?

0 Answers  






which header file contains main() function in c?

17 Answers   Google, HCL, TCS,


Where static variables are stored in c?

0 Answers  


how to find string length wihtout using c function?

6 Answers  


Do character constants represent numerical values?

0 Answers  


main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); }

11 Answers   CISOC, CitiGroup, College School Exams Tests,


What is the purpose of the code, and is there any problem with it? unsigned int f( unsigned n ) { return –n & 7; }

1 Answers   Google,


If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?

0 Answers  


Categories