Answers for "sum of digits in a number in o(1)"

0

sum of digits

num = [int(d) for d in input("Enter the Number:")]
sum = 0
for i in range(0, len(num)):
    sum = sum + num[i]

print("Sum of Digits of a Number: {}".format(sum))

# This code is contributed by Shubhanshu Arya (Prepinsta Placement Cell Student)
Posted by: Guest on May-03-2021

Code answers related to "sum of digits in a number in o(1)"

Python Answers by Framework

Browse Popular Code Answers by Language