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

Comments

Popular posts from this blog

bb.utils.contains yocto

Difference between RDEPENDS and DEPENDS in Yocto

make config vs oldconfig vs defconfig vs menuconfig vs savedefconfig