To find the total number of digits in a number, consider number as a variable called num.
1. divide the num with 10.
2. store the result again in num, and increment the count value to 1.
3. step 1 and 2 repeats until num becomes 0.
4. exit loop and print count value as result.
C Program to Find Sum of Individual Digits of a Positive Integer Number has similar logic, but in every step we perform the sum of digits.
OUTPUT:
Enter a number: 4658 Total number of digits in a given number: 4