[프로그래머스 | Lv.0] 자릿수 더하기

이승민·2023년 7월 25일
0

프로그래머스

목록 보기
9/27

https://school.programmers.co.kr/learn/courses/30/lessons/120906

📝 나의 풀이

using System;

public class Solution {
    public int solution(int n) {
        int answer = 0;
        
        while (0<n){
            answer+=n%10;
            n= n/10;
        }
        return answer;
    }
}

0개의 댓글

관련 채용 정보