Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

python program to find sum of digits of a number using while loop

#  Write a Program to display sum of all digits of a given
#  Number N by user

n = int(input('Enter a number : '))
sum=0

while(n>0):
    rem = n%10
    sum = sum+rem
    n = n//10
print('reversed no. is : ',int(sum))
 
PREVIOUS NEXT
Tagged: #python #program #find #sum #digits #number #loop
ADD COMMENT
Topic
Name
3+8 =