Check if the number is divisible 43 or not | Function to check if the number is divisible by 43 or not ; While there are at least two digits ; Extracting the last ; Truncating the number ; adding thirteen times the last digit to the remaining number ; Finally return if the two - digit number is divisible by 43 or not ; Driver Code
function isDivisible ( n ) { let d ; while ( parseInt ( n / 100 ) > 0 ) { d = n % 10 ; n = parseInt ( n / 10 ) n = Math . abs ( n + ( d * 13 ) ) ; } return ( n % 43 == 0 ) ; } let N = 2795 ; if ( isDivisible ( N ) ) document . write ( " " ) ; else document . write ( " " ) ;