Professional Documents
Culture Documents
MATRIX MULTIPLICATION
MATRIX MULTIPLICATION
AIM:
To write a c-program to perform matrix multiplication.
ALGORITHM:
STEP1: Start
STEP2: include necessary header files
STEP3: get necessary in particular data type
STEP4: get the number of rows and columns using printf() and scanf() functions
STEP5: initialize separate for loops to print the elements of matrix A and B
STEP6: use another for loop to print the multiplied elements of A and B
STEP7: stop
PROGRAM:
#include<stdio.h>
#include<stdlib.h>
int main(){
int a[10][10],b[10][10],mul[10][10],r,c,i,j,k;
printf("enter the number of row=");
scanf("%d",&r);
printf("enter the number of column=");
scanf("%d",&c);
printf("enter the first matrix element=\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("enter the second matrix element=\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
OUTPUT:
223
145
147
458
139
123
13 22 43
13 27 59
15 31 65
RESULT: