Pythom Program to get the sum of digits of 5-digit number
#sum of five digits of the num
number=input(" Enter the 5 digit number")
if number<9999 and number>99999:
print "Enter 5 digit number only"
else:
sum=0
while(number>0):
rem=number%10
sum=sum+rem
number=number/10
print "the sum is ",sum
number=input(" Enter the 5 digit number")
if number<9999 and number>99999:
print "Enter 5 digit number only"
else:
sum=0
while(number>0):
rem=number%10
sum=sum+rem
number=number/10
print "the sum is ",sum
Comments
Post a Comment