C-programming - Program for matrix multiplication using functions, C Program to Multiply Matrix Numbers
Program for matrix multiplication using functions
C Program for Matrix Multiplication Using Functions, This below code will help to multiply matrix numbers.Program Coding
#include<stdio.h> int a[3][3],b[3][3],c[3][3],i,j,k; int m1,m2,n1,n2; int mul(); int disp(); main() { printf("Enter the size of the matrix:"); scanf("%d%d%d%d",&m1,&n1,&m2,&n2); if(n1==m2) { printf("Enter the values for matrix\n"); for(i=0;i<m1;i++) { for(j=0;j<m1;j++) { scanf("%d",&a[i][j]); } } printf("Enter the values of the matrix B:"); for(i=0;j<m2;j++) { for(j=0;j<n2;j++) { scanf("%d",&b[i][j]); } } } mul(); } int mul() { printf("Matrix multiplication is \n"); for(i=0;i<m1;i++) { for(j=0;j<n1;j++) { For(k=0;k<m2;k++) { C[i][j]=c[i][j]+(a[i][k]*b[k][j]); } } } disp(); } int disp() { for(i=0;i<m1;i++) { for(j=0;j<m2;j++) { printf("%d",c[i][j]); } printf("\n"); } }
The topic on C-programming - Program for matrix multiplication using functions is posted by - Patel
Hope you have enjoyed, C-programming - Program for matrix multiplication using functionsThanks for your time