Matrix Multiplication In C Programming

Thank You Vinay Kumar For Writing The Source Code About Matrix Multiplication In C Programming.
 

How To Copy & Paste This SourceCode Into Your C Programming Code Editor :

1. Copy Source Code Below

2. Open A New Notepad/Text Document

3. Paste The Source Code

4. Then Save The Source Code Document As Example.C(You Will Save The Document With The Extension '.C')

5. In The Location C:/ExampleCodeEditor(TurboC3)/Disk/TurboC3/BIN/ExampleCodeName(Example.C)

6. Now Open The C Programming Code Editor And Click Open/F3 Then Type What Name Giving To That Source Code In The Past Time Like Example.C

7. Then Select Open, It Will Be Opened Successfully

8. Now Compile The Source Code & Check Any Errors In That Source Code

9. Finally, No Errors In That Code & Successfully Run The Code

Source Code Here :

Sample Input

#include<stdio.h>

#include<conio.h>

void main()

{

int a[20][20],b[20][20],mul[20][20],r,c,i,j,k;

clrscr();

printf("the matrices are\n");

printf("size of row=\n");

scanf("%d",&r);

printf("sizeof column=\n");

scanf("%d",&c);

printf("matrix of A\n");

for(i=0;i<r;i++)

{

for(j=0;j<c;j++)

{

scanf("%d",&a[i][j]);

}

}

printf("matrix of A Is \n");

for(i=0;i<r;i++)

{

for(j=0;j<c;j++)

{

printf("%d\t",a[i][j]);

}

printf("\n");

}

printf("matrix of B is\n");

for(i=0;i<r;i++)

{

for(j=0;j<c;j++)

{

scanf("%d",&b[i][j]);

}

}

printf("matrix ofB is\n");

for(i=0;i<r;i++)

{

for(j=0;j<c;j++)

{

printf("%d\t",b[i][j]);

}

printf("\n");

}

for(i=0;i<r;i++)

{

for(j=0;j<c;j++)

{

mul[i][j]=0;

for(k=0;k<c;k++)

{

mul[i][j]=mul[i][j]+a[i][k]*b[k][j];

}

}

}

for(i=0;i<r;i++)

{

for(j=0;j<c;j++)

{

printf("%d\t",mul[i][j]);

}

printf("\n");

}

getch();

}

Screenshots Of Copy & Paste The Source Code