Computer Science, asked by srinanthini2kk3, 7 days ago

write a c program for matrix addition​

Answers

Answered by debarghyaray53
0

Answer:

Program to perform basic matrix operations | Matrix multiplication

int mat1[10][10], mat2[10][10], mat3[10][10]; printf(“Enter number of rows and columns of mat1 matrix\n”);

printf(“Enter elements of matrix 1\n”); for (c = 0; c < m; c++)

scanf(“%d”, &mat1[c][d]); ...

printf(“\nEnter elements of matrix2\n”);

Explanation:

 \sqrt{ \frac{ \frac{ \frac{ \sqrt[ \frac{ \frac{hope \: it \: helps \: yu \times \frac{?}{?} }{?} }{?} ]{?} }{?} }{?} }{?} }

Answered by itsmerockingaarav
0

Answer:

#include <stdio.h>

int main()

{

int m, n;

scanf(“%d %d”,&m,&n);

int i, j;

int mat1[m][n], mat2[m][n], mat3[m][n];

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

{

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

scanf(“%d”,&mat1[i][j]);

}

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

{

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

scanf(“%d”,&mat2[i][j]);

}

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

{

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

{

mat3[i][j] = mat1[i][j] + mat2[i][j];

}

}

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

{

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

printf(“%d “, mat3[i][j]);

printf(“\n”);

}

return 0;

}

Similar questions