https://school.programmers.co.kr/learn/courses/30/lessons/120906
class Solution {
public int solution(int n) {
int answer = 0;
String str = n + ""; // ๋ฌธ์์ด๋ก ๋ณํ
for(int i = 0; i < str.length(); i++){
char c = str.charAt(i); // ๋ฌธ์ ํ๋์ฉ ์๋ผ์
answer += Character.getNumericValue(c); // ์ ์๋ก ๋ณํํด์ค ๋ค์ ๋ํ๊ธฐ
}
return answer;
}
}