#include <stdio.h>
void main() {
char data[12] = {0, 0, 2, 0, 1, 1, 0, 0, 2, 1, 0, 2};
int i, x, y;
for(int i=0; i<12; i++){
x = i%4 +1;
y = i/4 +1;
printf("%d행 %d열에", y, x);
if (data[i] == 1) printf(" 검은 돌이 놓여 있습니다. \n");
else if (data[i] == 2) printf(" 흰 돌이 놓여 있습니다. \n");
else printf("는 돌이 놓여 있지 않습니다. \n");
}
printf("\n");
printf("-------------------------------\n");
printf("\n");
char data2[3][4] = {{0, 0, 2, 0}, {1, 1, 0, 0}, {2, 1, 0, 2}};
int x1, y1;
for(x1=0; y1<3; y1++){
for(x1=0; x1<4; x1++){
printf("%d행 %d열에", y1 +1, x1 +1);
if(data2[y1][x1] ==1) printf(" 검은 돌이 놓여 있습니다. \n");
else if(data2[y1][x1] ==2) printf(" 흰 돌이 놓여 있습니다. \n");
else printf("는 돌이 놓여 있지 않습니다. \n");
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: