(코린이) 자릿수 더하기

ukyungci·2023년 9월 17일

프로그래머스LV0

목록 보기
8/8
class Solution {
    public int solution(int n) {
        int answer = 0;
        while (n > 0) {
            answer += n%10;
            n/=10;
        }
         return answer;
    }
}

0개의 댓글