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
What is a static function in c?
What is the difference between array and structure in c?
What is volatile, register definition in C
Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?
What is function definition in c?
If errno contains a nonzero number, is there an error?
How are variables declared in c?
Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings
What is the purpose of clrscr () printf () and getch ()?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?
How do we make a global variable accessible across files? Explain the extern keyword?
struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer
What are pragmas and what are they good for?
How to Throw some light on the splay trees?