8000 [기초-2차원배열] 성실한 개미 · hellonayeon/c-cpp@09f66ad · GitHub
[go: up one dir, main page]

Skip to content

Commit 09f66ad

Browse files
committed
[기초-2차원배열] 성실한 개미
1 parent 0f1b97d commit 09f66ad

File tree

1 file changed

+28
-0
lines changed
  • CodeUp C언어 기초 100제

1 file changed

+28
-0
lines changed

CodeUp C언어 기초 100제/1099.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include <stdio.h>
2+
3+
int main() {
4+
int arr[11][11] = {0};
5+
int i, j;
6+
int x=2, y=2;
7+
8+
for (i=1; i<=10; i++) {
9+
for (j=1; j<=10; j++) {
10+
scanf("%d", &arr[i][j]);
11+
}
12+
}
13+
14+
while (arr[x][y] != 2) {
15+
arr[x][y] = 9;
16+
if (arr[x][y+1] != 1) y++;
17+
else if(arr[x+1][y] != 1) x++;
18+
else break;
19+
}
20+
arr[x][y] = 9;
21+
22+
for (i=1; i<=10; i++) {
23+
for (j=1; j<=10; j++) {
24+
printf("%d ", arr[i][j]);
25+
}
26+
printf("\n");
27+
}
28+
}

0 commit comments

Comments
 (0)
0