Please solve this
Archiviert 3 years ago
N
Nilima
Write a Python program that takes a number and prints how many digits are in that number.
[Consider the input number to be an INTEGER.]
(You are not allowed to use len() function]
Example: If the user gives 9876, your program should print 4.
Hint: We may keep floor dividing by ten and count how many times this can be done until the number becomes 0 as illustrated below.
9876 // 10=987, count = 1 then, 987 // 1098, count = 2
98 // 109, count = 3
9//100, count = 4 Done! When the number becomes 0 your loop can end giving you the count of digits, in this case for our input of 9876, 4 digits.
