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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started