코딩테스트/[C#] 프로그래머스
[프로그래머스 | Lv.0] 자릿수 더하기
냠냠쿠
2023. 8. 13. 19:25
728x90
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;
}
}
728x90