Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def count_digits(n):
- count = 0
- while n != 0:
- n //= 10
- count += 1
- return count
- num = int(input("Enter a number: "))
- digits = count_digits(num)
- print("Number of digits:", digits)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement