Check if any large number is divisible by 17 or not | Function to check if the number is divisible by 17 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 17 ; Driver code
< ? php function isDivisible ( $ n ) { while ( $ n / 100 != 0 ) { $ d = ( int ) $ n % 10 ; $ n /= 10 ; $ n -= $ d * 5 ; } return ( $ n % 17 == 0 ) ; } $ n = 19877658 ; if ( isDivisible ( $ n ) ) print ( " Yes " ) ; else print ( " No " ) ; ? >