Sum of the digits of a number (function)
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Write a function:
int suma(int n); in C++
function suma(n: longint): longint; in Pascal
def suma(n): in Python
This function should return the sum of the digits of the number n.
For example, for the number 123, the sum of the digits is 6.
Examples
Input #1
Answer #1
Submissions 3K
Acceptance rate 19%