Sum of the digits of a number (function)#9394

Sum of the digits of a number (function)

1 second
64 megabytes
Very easy

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 .

For example, for the number , the sum of the digits is .

Examples

Example 1

Loading
Loading