問題1 回答


#include<stdio.h>

void calc(int a[][5], int b[][5], int c[][5]);

main()
{
   int a[5][5], b[5][5], c[5][5], x, y;

   for(x = 0; x < 5; x++){
      for(y = 0; y < 5; y++){
         scanf("%d", &a[x][y]);
      }
   }

   for(x = 0; x < 5; x++){
      for(y = 0; y < 5; y++){
         scanf("%d", &b[x][y]);
      }
   }

   calc(a, b, c);

   for(x = 0; x < 5; x++){
      for(y = 0; y < 5; y++){
         printf("%d", c[x][y]);
      }
   }
}

int calc(int a[][5], b[][5], c[][5])
{
   int x, y;

   for(x = 0; x < 5; x++){
      for(y = 0; y < 5; y++){
         c[x][y] = a[x][y] + b[x][y];
      }
   }
}


[ 戻る ]