C Program to Count Number of Digits
In this program we will take an integer from user and count the number of digits.
- // C program to count number of digits
- #include <stdio.h>
- int main()
- {
- long long x;
- int count = 0;
- printf("Enter any number: ");
- scanf("%d", &x);
- while(x != 0)
- {
- count++;
- x/= 10;
- }
-
- printf("Total digits: %d", count);
- return 0;
- }
Output

Solution not working or have any suggestions? Please send an email to [email protected]
Download Android App