백준 31403 c : 구현 다시 정리

magicdrill·2025년 5월 23일
0

백준 문제풀이

목록 보기
610/654

백준 31403 c : 구현 다시 정리

정수를 문자열로 고치기, 문자열 조작하기

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#pragma warning(disable:4996)

int main(void) {
	int A, B, C;
	char strA[20], strB[20], AB[40];

	scanf("%d %d %d", &A, &B, &C);

	sprintf(strA, "%d", A);
	sprintf(strB, "%d", B);
	strcpy(AB, strA);
	strcat(AB, strB);

	int AB_num = atoi(AB);

	printf("%d\n", A + B - C); 
	printf("%d\n", AB_num - C); 

	return 0;
}

0개의 댓글