Sum of digits (function)#169

Sum of digits (function)

1 second
64 megabytes
Very easy (≈850)

Implement the following function:

int suma(int n){
    //complete the function.
}  

Calculate the sum of the digits of the given number . For example, the sum of the digits of the number n = 123 is .

Examples

Example 1

Loading
Loading