Python Program to input 3 digit number and print the sum of all digits


n=int(input('3 digit no.'))

sum=0

for i in range(3):

  a=n%10

  sum+=a

  n=n//10

print(sum) 

Comments

Some popular posts

Python Program that computes the net amount of a bank account based a transaction log from console input.