Program Code:

#include <stdio.h>
int main()
{
    long long n;
    int count=0;
    printf("Enter an integer: ");
    scanf("%lld", &n);
    while(n!=0)
    {
        n = n/10;
        ++count;
    }
    printf("Number of digits: %d",count);
}

Output:

Enter an integer: 45729
Number of digits: 5

Leave a Reply

Your email address will not be published. Required fields are marked *