본문 바로가기

C++문법

숫자 맨 뒤에서 하나씩 빼고 제거할 때

int n, num;

 

sum += n % 10;
n = n / 10;