Digit Sum
Given a non-negative integer n, go through its digits and add them together. This kind of operation appears in checks, games, and simple number algorithms. Return the total sum.
Примеры
Ввод
12345Вывод
15Ввод
0Вывод
0Ввод
999Вывод
27Нужно реализовать
def sum_of_digits(n: int) -> int:
Теги
math
Log ind for at se indsendelseshistorik
Log indLog ind for at bruge AI-mentor
Log indVisible tests
1
Input
12345Expected
152
Input
0Expected
03
Input
999Expected
274
Input
100Expected
15
Input
1000Expected
16
Input
1Expected
1Focus radio
Paused · SomaFM · Fluid