Game of Digits

Description:

Develop a program that reads a four-digit integer from the user and displays the sum of the digits in the number. For example, if the user enters 3141 then your program should display 3+1+4+1=9. Test Case 1 Input (stdin) 9091972 Expected Output The total sum of digits is: 37 Test Case 2 Input (stdin) 25121988 Expected Output The total sum of digits is: 36

Program :

n=int(input())

sum=0

while(n!=0):

    r=n%10

    sum=sum+r

    n=n//10

print("The total sum of digits is:",sum)