Skip to content

Commit 9244871

Browse files
committed
240620 정보처리기사 실기 - C언어 (2023-1회 9번)
1 parent f83a9e9 commit 9244871

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Diff for: EIP/C/README.md

+27
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,33 @@
502502
503503
- [답] qwe
504504
505+
- 문제9. 다음은 이진수를 십진수로 변환하는 C언어 코드이다. 괄호 (a) (b) 에 적합한 답을 작성하시오.
506+
507+
```c
508+
#include <stdio.h>
509+
510+
int main() {
511+
int input = 101110;
512+
int di = 1;
513+
int sum = 0;
514+
515+
while (1) {
516+
if (input == 0) break
517+
else {
518+
sum = sum + (input (a)(b)) * di;
519+
di = di * 2;
520+
input = input / 10;
521+
}
522+
}
523+
printf("%d", sum);
524+
return 0;
525+
}
526+
```
527+
528+
- []
529+
- (a) % (b) 10 or 5 or 2
530+
- (a) & (b) 1
531+
505532

506533

507534
#### 2023년 2회

0 commit comments

Comments
 (0)