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