Question: Write a program that reads a positive integer less than 1000 and prints how many digits the number has, by checking whether the number is
Write a program that reads a positive integer less than 1000 and prints how many digits the number has, by checking whether the number is 10, 100. The program will run continuously in a loop, checking with the user if he/she wants to try again. If the answer is yes the program will run again, asking the user to enter a number. If the answer is no, the loop will stop.
Example of output:
Enter a number: 125
Three digits
Do you want to try again? yes
Enter a number: 24
Two digits.
Do you want to try again? yes
Enter a number: 3
One digit.
Do you want to try again? no
Bye!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
