E-Learning Gue

Coding Adding 2 Matrices..Using C++


#include
void main()

{
int matrix1[3][3], matrix2[3][3], matrix3[3][3];
int row, column;


printf ("Enter the order of matrix1 3X3:\n");

for(row=0; row<3; row++)
for (column=0; column<3; column++)

{ scanf("%d", &matrix1[row][column]);}


printf ("\nEnter the order of matrix2 3X3:\n");

for(row=0; row<3; row++)
for (column=0; column<3; column++)

{ scanf("%d", &matrix2[row][column]);}


printf("\nMatrix1 + Matrix2:\n");

for(row=0; row<3; row++)
for (column=0; column<3; column++)

{
matrix3[row][column]= matrix1[row][column]+ matrix2[row][column];
printf("%d\n",matrix3[row][column]);
}


return 0;
}

No comments: