Check if a number is multiple of 5 without using / and % operators | Assuming that integre takes 4 bytes , there can be maximum 10 digits in a integer ; Check the last character of string ; Driver Code
< ? php $ MAX = 11 ; function isMultipleof5 ( $ n ) { global $ MAX ; $ str = ( string ) $ n ; $ len = strlen ( $ str ) ; if ( $ str [ $ len - 1 ] == '5' $ str [ $ len - 1 ] == '0' ) return true ; return false ; } $ n = 19 ; if ( isMultipleof5 ( $ n ) == true ) echo " $ n ▁ is ▁ multiple ▁ of ▁ 5" ; else echo " $ n ▁ is ▁ not ▁ a ▁ multiple ▁ of ▁ 5" ; ? >