Menu
Coddy logo textTech

Sum of Digits

Lesson 15 of 17 in Coddy's Functions in C course.

challenge icon

Challenge

Easy

Write a function that calculates the sum of digits in a number.

For example, if the input is 1234, the output is:10

Try it yourself

#include <stdio.h>
int sumOfDigits(int n) {
 
}

All lessons in Functions in C