#include <stdio.h>
int hap(int);
void main(void) {
int i, tot =0;
for(i=0; i<3; i++) tot = tot+hap(i); // i=1 hap(5), 2번째 hap(11), 3번째 hap(17) tot=33
printf("%d\n", tot);
}
int hap(int i){
static int a[3][4]= {{1, 2, 3, 0}, {4, 5, 6, 0}, {7, 8, 9, 0}};
int j, sum =0;
for (j=1; a[i][j]!=0; j++) //j=1 a[0][1]+a[0][2], j=2 a[1][1]+a[1][2], j=3 a[2][1]+a[2][2]
sum=sum+a[i][j];
return sum;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: