Digit Count

Given a number the task is to find out the number of digits present in the number.

Example 1: Let us take a number 3412. Here total number of digits is 5.

C
#include <stdio.h>
int main()
{
    int n=0,count=0;
    printf("Enter a number: ");
    scanf("%d",&n);
    while(n>0)
    {
        count++;
        n=n/10;
    }
    printf("It is a %d digit number",count);
    return 0;
}
C