Question: Write a C program that counts the number of digits in a given positive integer using a while loop. The program should prompt the user
Write a C program that counts the number of digits in a given positive integer using a while loop.
The program should prompt the user to enter a positive integer and then the program should count the number of digits in it using a while loop. Once done, the program should display the count on the screen.
Program requirements:
The program should prompt the user to enter a positive integer.
The input should be a positive integer if the user enters a negative number or zero display an error message and display the prompt again
You must use a while loop
The program should display the count of digits as the output use a full sentence and the original input in your output
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
