#include <stdio.h>
void calculate(int (*a)[4]);
int main(void) {
int a[][4]={
{1,2,3,4},
{5,6,7,8},
{9,10,11,12},
};
calculate(a);
return 0;
}
void calculate(int (*a)[4]){
int sum;
for(int i=0; i<3;i++){
sum=0;
for(int j=0;j<4;j++){
sum+=a[i][j];
}
printf("%d行目の和は%dです\n",i
+1,sum
);
}
}
I2luY2x1ZGUgPHN0ZGlvLmg+CnZvaWQgY2FsY3VsYXRlKGludCAoKmEpWzRdKTsKCmludCBtYWluKHZvaWQpIHsKCWludCBhW11bNF09ewoJCXsxLDIsMyw0fSwKCQl7NSw2LDcsOH0sCgkJezksMTAsMTEsMTJ9LAoJfTsKCQoJY2FsY3VsYXRlKGEpOwoJcmV0dXJuIDA7Cn0KCnZvaWQgY2FsY3VsYXRlKGludCAoKmEpWzRdKXsKCWludCBzdW07CgkKCWZvcihpbnQgaT0wOyBpPDM7aSsrKXsKCQlzdW09MDsKCQlmb3IoaW50IGo9MDtqPDQ7aisrKXsKCQkJc3VtKz1hW2ldW2pdOwoJCX0KCQkKCQlwcmludGYoIiVk6KGM55uu44Gu5ZKM44GvJWTjgafjgZlcbiIsaSsxLHN1bSk7CgkJCgl9Cn0=