Python Program to Count the Number of Digits Present In a Number Using While Loop
# Count the Number of Digits Present In a Number using while loop in python num = 123456 count = 0 while num != 0: num //= 10 count += 1 print("Number of digits: " + str(count))
Output:
Number of digits: 6