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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!