MCPcopy Create free account
hub / github.com/TheAlgorithms/C-Plus-Plus / sum_of_digits

Function sum_of_digits

math/sum_of_digits.cpp:23–34  ·  view source on GitHub ↗

* Function to find the sum of the digits of an integer. * @param num The integer. * @return Sum of the digits of the integer. * * \detail * First the algorithm check whether the num is negative or positive, * if it is negative, then we neglect the negative sign. * Next, the algorithm extract the last digit of num by dividing by 10 * and extracting the remainder and this is added to the sum

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 2

test1Function · 0.85
test2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected