A digit in input number must be less than number 's base
if ( val ( str [ i ] ) >= base_var ) { Console . WriteLine ( " Invalid ▁ Number " ) ; return - 1 ; } num += val ( str [ i ] ) * power ; power = power * base_var ; } return num ; }