Sum of digit means that we add the digit of the number like
then it sum of digit is 1+2+2+5 which is 10
print("Enter any number")
print("Sum of digit is- ",end=" ")
Enter any number
Sum of digit is- 9
- In this program, firstly we take input of number and run while loop in number of digits times and % operator 10 is pick the each digit and add in 'ans' and at last we print the 'ans' which is the sum of the digit of the given number.