AnswerBox
C

Sum of Digits

Description:
Find the sum of digits of a number.
C Code
#include <stdio.h>
int main() {
    int n = 12345, sum = 0;
    while (n > 0) { sum += n % 10; n /= 10; }
    printf("Sum of digits: %d\n", sum);
    return 0;
}
Expected Output
Sum of digits: 15