Program to count digits in an integer

Count the number of digits in a long integer entered by a user.

int countDigit(long long n) 
{ 
    int count = 0; 
    while (n != 0) { 
        n = n / 10; 
        ++count; 
    } 
    return count; 
} 
原文地址:https://www.cnblogs.com/JasperZhao/p/12814593.html