Check if a number is multiple of 5 without using / and % operators | Assuming that integer takes 4 bytes , there can be maximum 10 digits in a integer ; Check the last character of string ; Driver Code
class GFG { static int MAX = 11 ; static bool isMultipleof5 ( int n ) { char [ ] str = new char [ MAX ] ; int len = str . Length ; if ( str [ len - 1 ] == '5' str [ len - 1 ] == '0' ) return true ; return false ; } static void Main ( ) { int n = 19 ; if ( isMultipleof5 ( n ) == true ) Console . WriteLine ( " { 0 } ▁ is ▁ " + " multiple ▁ of ▁ 5" , n ) ; else Console . WriteLine ( " { 0 } ▁ is ▁ not ▁ a ▁ " + " multiple ▁ of ▁ 5" , n ) ; } }