[JAVA 문제 풀이] 215. 자릿수 더하기

프로그래머스 (12931)
Stupefyee's avatar
Apr 22, 2025
[JAVA 문제 풀이] 215. 자릿수 더하기
notion image
 

내가 작성한 코드

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

stupefyee