문제
내가 작성한 코드
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
int x;
scanf("%d", &x);
printf("%x\n", x);
return 0;
}
이번 문제는 %d와 %x의 차이점을 보여주는 문제인 듯하다
int형으로 %d를 이용해 입력받고
int형 변수를 %x를 이용해 출력하면 16진수로 출력이 되더라
'C언어 > 문제은행' 카테고리의 다른 글
[3주차] "Hello, World!" in C (0) | 2023.04.19 |
---|---|
[2주차] Challenge - sorting and counting (0) | 2023.04.18 |
[2주차] 별찍기 (0) | 2023.04.18 |
[2주차] 16진수 덧셈 (0) | 2023.04.18 |
[2주차] 사칙연산 (0) | 2023.04.18 |