Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

suma de digitos

//Recursive function to find sum of digits of a number
int sumOfDigits(int num){
    // Base condition
    if(num == 0){
        return 0;
    }

    return ((num % 10) + sumOfDigits(num / 10));
}
 
PREVIOUS NEXT
Tagged: #suma #de #digitos
ADD COMMENT
Topic
Name
1+9 =