Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

C++ sum a vector of digits

 // Sum digits in vector
int digit_sum(vector<int> num) {
    int sum = 0;
    for (auto x : num) sum += x;
    return sum;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sum #vector #digits
ADD COMMENT
Topic
Name
8+9 =