Check if Decimal representation of an Octal number is divisible by 7 | Function to check Divisibility ; Sum of all individual digits ; Condition ; Octal number
< ? php function check ( $ n ) { $ sum = 0 ; while ( $ n != 0 ) { $ sum += $ n % 10 ; $ n = ( int ) ( $ n / 10 ) ; } if ( $ sum % 7 == 0 ) return 1 ; else return 0 ; } $ n = 25 ; ( check ( $ n ) == 1 ) ? print ( " YES STRNEWLINE " ) : print ( " NO STRNEWLINE " ) ; ? >