C program to count number of digits in an integer

PROGRAM:

#include <stdio.h>
int main()
{
    long long n;
    int count = 0;

    printf("Enter an integer: ");
    scanf("%lld", &n);

    while(n != 0)
    {
        n /= 10;
        ++count;
    }

    printf("Number of digits: %d", count);
}

OUTPUT:

Enter an integer: 3452
Number of digits: 4