1~5. 다음 코드에 대한 출력 결과를 쓰시오.
1.
#include <stdio.h>
int main() {
int a = 3, b = 7;
printf("%d\n", a * b);
return 0;
}
2.
#include <stdio.h>
int main() {
float x = 5.5, y = 2.0;
printf("%.1f\n", x / y);
return 0;
}
3.
#include <stdio.h>
int main() {
int a = 10;
a += 5;
printf("%d\n", a);
return 0;
}
4.
#include <stdio.h>
int main() {
int x = 8, y = 3;
printf("%d\n", x % y);
return 0;
}
5.
#include <stdio.h>
int main() {
int a = 2, b = 3, c = 4;
printf("%d\n", a * b + c);
return 0;
}
정답
(드래그 시 정답이 보입니다.)
1. 21
2. 2.8
3. 15
4. 2
5. 10
'Study > 정보처리기사' 카테고리의 다른 글
| C언어 Level 6 (0) | 2025.02.20 |
|---|---|
| C언어 Level 5 (0) | 2025.02.20 |
| C언어 Level 4 (0) | 2025.02.20 |
| C언어 Level 3 (0) | 2025.02.20 |
| C언어 Level 2 (0) | 2025.02.20 |