0% found this document useful (0 votes)
3 views2 pages

Matrix Multiplication

The document contains a C program for matrix multiplication. It prompts the user to input the dimensions and elements of two matrices, performs the multiplication, and then displays the resulting matrix. The program uses nested loops to calculate the product of the matrices and prints the output in a formatted manner.

Uploaded by

Nidhi Rao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Matrix Multiplication

The document contains a C program for matrix multiplication. It prompts the user to input the dimensions and elements of two matrices, performs the multiplication, and then displays the resulting matrix. The program uses nested loops to calculate the product of the matrices and prints the output in a formatted manner.

Uploaded by

Nidhi Rao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

MATRIX MULTIPLICATION

1. #include<stdio.h>
2. #include<stdlib.h>
3. int main(){
4. int a[10][10],b[10][10],mul[10][10],r,c,i,j,k;
5. printf("enter the number of row=");
6. scanf("%d",&r);
7. printf("enter the number of column=");
8. scanf("%d",&c);
9. printf("enter the first matrix element=\n");
10.for(i=0;i<r;i++)
11.{
12.for(j=0;j<c;j++)
13.{
14.scanf("%d",&a[i][j]);
15.}
16.}
17.printf("enter the second matrix element=\n");
18.for(i=0;i<r;i++)
19.{
20.for(j=0;j<c;j++)
21.{
22.scanf("%d",&b[i][j]);
23.}
24.}
25.
26.printf("multiply of the matrix=\n");
27.for(i=0;i<r;i++)
28.{
29.for(j=0;j<c;j++)
30.{
31.mul[i][j]=0;
32.for(k=0;k<c;k++)
33.{
34.mul[i][j]+=a[i][k]*b[k][j];
35.}
36.}
37.}
38.for(i=0;i<r;i++)
39.{
40.for(j=0;j<c;j++)
MATRIX MULTIPLICATION
41.{
42.printf("%d\t",mul[i][j]);
43.}
44.printf("\n");
45.}
46.return 0;
47.}

You might also like