MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / digitsum

Method digitsum

CodeChef_problems/MINDSUM/solution.cpp:29–36  ·  view source on GitHub ↗

Calculates the sum of the digits*/

Source from the content-addressed store, hash-verified

27 unordered_map <ll,bool> :: iterator it;
28 /*Calculates the sum of the digits*/
29 ll digitsum(ll k) {
30 ll res = 0;
31 while (k) {
32 res += k%10;
33 k = k/10;
34 }
35 return res;
36 }
37 /*Recursively calls the valid operations i.e. digitsum(N) or N+D */
38 void recurse(ll m, ll count) {
39 if(min > m ){

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected