How Many Digits in a Given Number
The c program to calculate how many digits are in the given number is useful when you working with large numbers. This function counts the number of digits and return the value otherwise the alert message will be displayed
C Program to Count Number of Digits of a Number
bool testProduct(int number, int numDigits, int[] digits) {
int x = 0;
int i = 0;
bool found = false;
while (number > 0) {
i = number % 10;
number /= 10;
for (x = 0; x < numDigits; x++) {
if (digits[x] == i) {
found = true;
break;
}
}
if (!found) return false;
found = false;
}
return true;
}