C언어/문제은행

[2주차] 16진수 덧셈

슈슈버거 2023. 4. 18. 15:30

문제


내가 작성한 코드

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main() {
    int x,y;

    scanf("%x %x", &x, &y);
    printf("%x\n", x+y);   
    return 0;
}

16진수로 애초에 int형에 입력을 시켜주었다.

왜냐! 16진수끼리의 연산을 해야되기 때문이지