#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 y=0;y<4;y++){
sum+=a[i][y];
}
printf("%d行目の和%d\n",i
+1,sum
);} }
I2luY2x1ZGUgPHN0ZGlvLmg+CnZvaWQgY2FsY3VsYXRlKGludCAoKmEpWzRdKTsKaW50IG1haW4odm9pZCkgewppbnQgYVtdWzRdPXt7MSwyLDMsNH0sCiAgICAgICAgICAgIHs1LDYsNyw4fSwKICAgICAgICAgICAgezksMTAsMTEsMTJ9LAp9OwpjYWxjdWxhdGUoYSk7CgoJcmV0dXJuIDA7Cn0Kdm9pZCBjYWxjdWxhdGUoaW50KCphKVs0XSl7CmludCBzdW07CgoJZm9yKGludCBpPTA7aTwzO2krKyl7CgkJc3VtPTA7CgkJZm9yKGludCB5PTA7eTw0O3krKyl7CgkJCXN1bSs9YVtpXVt5XTsKICAgICB9CnByaW50ZigiJWTooYznm67jga7lkowlZFxuIixpKzEsc3VtKTt9Cn0=