전공부셔/c
[프로그래머스] 더 크게 합치기
m-inz
2023. 8. 27. 13:29
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
int solution(int a, int b) {
char num1[9];
char num2[9];
snprintf(num1,9,"%d%d\0",a,b);
snprintf(num2,9,"%d%d\0",b,a);
return atoi(num1)>=atoi(num2) ? atoi(num1) : atoi(num2);
}
a의 최대 자릿수 : 4
b의 최대 자릿수 : 4
4 + 4 + 1 = 9
*숫자를 문자열로 변환
sprintf()