sumofdigits = 0
num =int(input("enter the number:"))
while(num!=0):
    temp=num%10
    sumofdigits = sumofdigits + temp
    num=num/10
print("the sum of digits is :",sumofdigits)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: