Answers for "sum=sum+digit%10;digit=digit/10;sum=sum+digit%10;digit=digit/10;sum=sum+digit%10;digit=digit/10; in c"

0

sum the digits of an integer

def getSum(n)
  n.digits.sum
end

print "Sum of digits = ", getSum(555);
Posted by: Guest on May-27-2021

Python Answers by Framework

Browse Popular Code Answers by Language