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

How can you call a function, given its name as a string?

0 Answers  


Write a C Programm.. we press 'a' , it shows the albhabetical number is 1, if we press 'g' it shows the answer 7.. any can help me

7 Answers  


What is zero based addressing?

0 Answers  


What is the difference between a function and a method in c?

0 Answers  


SIR PLS TELL ME THE CODE IN C LANGUAGE TO PRINT THE FOLLOWING SERIES 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 1 2 3 2 1 1 2 1 1

4 Answers  






main() {int a=200*200/100; printf("%d",a); }

14 Answers   TCS,


12. Look at the Code: main() { int a[]={1,2,3},i; for(i=0;i<3;i++) { printf("%d",*a); a++; } } Which Statement is/are True w.r.t the above code? I.Executes Successfully & Prints the contents of the array II.Gives the Error:Lvalue Required III.The address of the array should not be changed IV.None of the Above. A)Only I B)Only II C)II & III D)IV

4 Answers   Accenture,


How do I read the arrow keys? What about function keys?

0 Answers  


CAN WE DEFINE ANY FUNCTION WITHIN A FUNCTION.

15 Answers  


Explain what does the function toupper() do?

0 Answers  


What is the purpose of ftell?

0 Answers  


Write a program to add the following ¼+2/4+3/4+5/3+6/3+... (Like up to any 12 no.s)

1 Answers   HTC,


Categories