The program takes in a number and finds the sum of digits in a number.
*************PROGRAM***************
*************PROGRAM***************
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)
No comments:
Post a Comment