Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- num = int(input("Enter a number: "))
- summ = 0
- if num > 0:
- while num != 0:
- summ = summ + num % 10
- num = num // 10
- print(summ)
- else:
- print("Число не натуральное!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement