Adding two Matrix (3 x 3) In C programming
The files "mata.txt" and "matb.txt" contain integer matrices of size 3 x 3. Write a program that calculates the sum of the matrices in a new matrix. The resulting sum matrix shall be saved to the file "sum.txt". #include<stdio.h> int main() { FILE *filea, *fileb,*filec; //initialize the files int arraya[3][3],arrayb[3][3],sum[3][3]; //initialize arrays which consists 3*3 elements int i ,j; //PART A //We try to read from file mata.txt (filea). if ((filea=fopen("mata.txt","r"))==NULL) // try to read from txt file { printf("Failed to open mata.txt"); } else { for(i=0;i<3;i++) { for(j=0;j<3;j++){ fscanf(filea,"%d",&arraya[i][j]); //reading f...