Find the Nth digit from right in base B of the given number in Decimal base | Function to compute Nth digit from right in base B ; Skip N - 1 Digits in Base B ; Nth Digit from right in Base B ; Driver Code
function nthDigit ( a , n , b ) { for ( var i = 1 ; i < n ; i ++ ) a = parseInt ( a / b ) ; return a % b ; } var a = 100 ; var n = 3 ; var b = 4 ; document . write ( nthDigit ( a , n , b ) ) ;