This is a Python Program to find the sum of digits in a number.


This is a Python Program to find the sum of digits in a number.

n=int(input("Enter a number:"))
tot=0
while(n>0):
    dig=n%10
    tot=tot+dig
    n=n//10
print("The total sum of digits is:",tot)


 

Post a Comment

Post a Comment (0)

Previous Post Next Post