C Program to Calculate How Many Digits in a Number

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


Related Topic C Program for Armstrong Number
JAVA Number-Format Example
Java Program for Armstrong Number
C Program to Generate ArmStrong Numbers
Java Program to Check Armstrong Number

nScraps.com 2011   Privacy Policy  Terms of Service  Feedback