We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 591a0d3 commit 3fe44edCopy full SHA for 3fe44ed
2 files changed
프로그래머스/0/120906. 자릿수 더하기/README.md
@@ -1,10 +1,10 @@
1
# [level 0] 자릿수 더하기 - 120906
2
3
-[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/120906?language=java)
+[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/120906)
4
5
### 성능 요약
6
7
-메모리: 73.2 MB, 시간: 0.03 ms
+메모리: 75.8 MB, 시간: 0.01 ms
8
9
### 구분
10
@@ -16,7 +16,7 @@
16
17
### 제출 일자
18
19
-2026년 06월 21일 13:44:30
+2026년 06월 24일 09:29:47
20
21
### 문제 설명
22
프로그래머스/0/120906. 자릿수 더하기/자릿수 더하기.java
@@ -1,13 +1,10 @@
class Solution {
public int solution(int n) {
int ans = 0;
- while (true) {
- if (n / 10 < 1) {
- ans += n % 10;
- return ans;
- }
+ while (n > 0) {
ans += n % 10;
- n = n / 10;
+ n /= 10;
11
}
+ return ans;
12
13
0 commit comments