C Program to count the number of digits in an Integer

Problem

Write a program in C to cound the number of digits in an integer that was entered by the user.

How to count the number of digits in an integer in turbo C ?

#include <stdio.h>
int main()
{
    printf("Abundantcode.com Coding sample\n");
    long input;
    int result = 0;

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

    while(input != 0)
    {
        input /= 10;
        ++result;
    }

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

Output

Abundantcode.com Coding sample                                                  
Enter an integer: 50102                                               
Number of digits: 5

%d