Computer Science, asked by therock3, 1 year ago

sum of two dimensional array

Answers

Answered by akash200
1
in the last loop type sum = a[i][j] +b[i][j]
Answered by unknownRU
0

Hope it helps

Mark me as Brainlist!

Sum of two dimensional array in c programming

#include<stdio.h>

#include<conio.h>

void main()

{

clrscr();

int mat1[2][3],mat2[2][3],mat3[2][3],i,j;

printf("Enter the elements of matrix1\n");

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

{

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

{

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

}

}

printf("the elements of the matrix2\n");

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

{

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

{

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

}

}

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

{

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

{

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

}

}

printf("\nthe result of matrix is\n");

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

{

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

{

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

}

printf("\n");

}

getchar();

}

Similar questions