Written in Java Develop a method that accepts an integer val
Written in Java: Develop a method that accepts an integer value and returns the number of significant digits needed to represent that value in a particular number base.
int digitsInBaseB(int value, int base)
Solution
int digitsInBaseB(int value, int base) {
int noOfDigits = 0;
while (value != 0) {
noOfDigits++;
value = value / base;
}
return noOfDigits;
}
