Skip to content

Commit 4e270d9

Browse files
committed
240621 정보처리기사 실기 - C언어 (2023-1회 14번)
1 parent 9244871 commit 4e270d9

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

Diff for: EIP/C/README.md

+28-1
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@
454454
455455
456456
457-
#### 2023년 1회 [3개 출제]
457+
#### 2023년 1회 [4개 출제]
458458
459459
- 문제2. 다음 C언어로 구현된 프로그램을 분석하여 그 실행 결과를 쓰시오. (단, 출력문의 출력 서식을 준수하시오)
460460
@@ -529,6 +529,33 @@
529529
- (a) % (b) 10 or 5 or 2
530530
- (a) & (b) 1
531531

532+
- 문제14. 다음은 버블 정렬을 이용하여 배열에 저장된 수를 오름차순으로 정렬하는 프로그램이다. ①, ② 에 들어갈 알맞은 답을 쓰시오.
533+
534+
```c
535+
#include <stdio.h>
536+
537+
void swap(int* a, int idx1, int idx2) {
538+
int t = a[idx1];
539+
a[idx1] = a[idx2];
540+
a[] = t;
541+
}
542+
543+
void Usort(int* a, int len) {
544+
for (int i = 0; i < len - 1; i++)
545+
for (int j = 0; j < len - 1 - i; j++)
546+
if (a[j] > a[j + 1])
547+
swap(a, j, j + 1);
548+
}
549+
550+
main() {
551+
int a[] = {85, 75, 50, 50, 100, 95};
552+
int nx = 5;
553+
Usort(a, ②);
554+
}
555+
```
556+
557+
- [답] ① idx2 ② nx
558+
532559
533560
534561
#### 2023년 2회

0 commit comments

Comments
 (0)