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

Function sumDigits

Misc/SumOfAllDigits/solution1.py:4–9  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

2
3# Find sum of digits of a number
4def sumDigits(n):
5 tot = 0
6 while(n > 0):
7 tot += n % 10
8 n //= 10
9 return tot
10
11# Recursively find sum of digits till the number is single digit
12def sumOfDigits(n):

Callers 2

sumOfDigitsFunction · 0.85
solution1.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected