Wednesday, June 1, 2011

To Perform Matrix Multiplication in C

0 comments
/*To perform matrix multiplication*/ #include<stdio.h> #include<conio.h> #include<math.h> void main() { int p,q,m,n,i,j,k; int a[25][25],b[25][25],c[25][25]; /*Enter the order of matrices*/ printf("Enter the order of matrix A (m,n)\n"); scanf("%d%d",&m,&n); printf("Enter order of matrix B (p,q) \n"); scanf("%d%d",&p,&q); if(n!=p) { printf("matrices not compatible"); } if(n==p) { /*Enter the elements of matrices*/ printf("enter the elements of matrix A"); for(i=1;i<=m;i++) { for(j=1;j<=n;j++) { scanf(%d",&a[i][j]); } } printf("enter the elements ...
Continue reading →