Check if any large number is divisible by 19 or not | Function to check if the number is divisible by 19 or not ; Extracting the last digit ; Truncating the number ; Subtracting the five times the last digit from the remaining number ; Return n is divisible by 19 ; Driver code
function isDivisible ( n ) { while ( parseInt ( n / 100 ) > 0 ) { var d = n % 10 ; n = parseInt ( n / 10 ) ; n += d * 2 ; } return ( n % 19 == 0 ) ; } var n = 101156 ; if ( isDivisible ( n ) ) document . write ( " " ) ; else document . write ( " " ) ;