Write a recursive method that parses a positive binary number as a string into a decimal integer.
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a recursive method that parses a positive binary number as a string into a decimal integer.
//Assume the input is always digit only.
//If the input is not a binary number, return the same number in the integer format
Sample Input1 //A binary input
11
Sample Output1
3
Sample Input2 //Not a binary input
00112
Sample Output2
112
Related Book For
Posted Date: