-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodeup_1099.c
More file actions
56 lines (41 loc) · 882 Bytes
/
codeup_1099.c
File metadata and controls
56 lines (41 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
int arr[10][10];
int i = 1, j = 1;
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++)
scanf("%d", &arr[i][j]);
}//숫자 입력받기
while (1) {
arr[i][j] = 9;
if (arr[i][j + 1] == 2) {
arr[i][j + 1] = 9;
break;
} // if x앞에 2면 종료
else if (!arr[i][j + 1]) {
arr[i][j + 1] = 9;
j++;
} // if x앞에 0이면
else if (arr[i][j + 1]) {
if (arr[i + 1][j] == 2) {
arr[i + 1][j] = 9;
break;
} // if y앞에 2면 종료
else if (!arr[i + 1][j]) {
arr[i + 1][j] = 9;
i++;
} // if y앞에 0이면
else if (arr[i][j + 1]) {
break;
} // if y앞에 1이면
} // if x앞에 1이면
}
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++)
printf("%d ", arr[i][j]);
printf("\n");
}//숫자 출력
return 0;
}