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; }
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; }