User:Tyagi3113

Programme for matrix multiplication
#include #include  main {  int a[50][50],b[50][50],c[50][50],i,j,r1,c1,r2,c2,k,mul=0; printf("\n\t Enter number of rows colomns of first matrix"); scanf("%d %d",&r1,&c1); printf("\n\t Enter number of rows colomns of second matrix"); scanf("%d %d",&r2,&c2); printf("\n\t Enter elements of first matrix"); for(i=0;i<r1;i++) { for(j=0;j<c1;j++) scanf("%d",&a[i][j]); }  printf("\n\t Enter elements of second matrix"); for(j=0;j<r2;j++) { for(k=0;k<c2;k++) scanf("%d",&b[j][k]); }  if(r1==c2) {   for(i=0;i<r1;i++) { for(j=0;j<c2;j++) { mul=0; for(k=0;k<r1;k++) mul+=(a[i][k]*b[k][j]); c[i][j]=mul; }   }   }   else printf("\n\t multiplication is not possible"); printf("\n\t After multiplication =\n"); for(i=0;i<r1;i++) { printf("\n"); for(j=0;j<c2;j++) printf(" %d ",c[i][j]); }   getch; }