Check if a number is multiple of 5 without using / and % operators | Assumes that n is a positive integer ; Driver Code
def isMultipleof5 ( n ) : NEW_LINE INDENT while ( n > 0 ) : NEW_LINE INDENT n = n - 5 NEW_LINE DEDENT if ( n == 0 ) : NEW_LINE INDENT return 1 NEW_LINE DEDENT return 0 NEW_LINE DEDENT i = 19 NEW_LINE if ( isMultipleof5 ( i ) == 1 ) : NEW_LINE INDENT print ( i , " is ▁ multiple ▁ of ▁ 5" ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( i , " is ▁ not ▁ a ▁ multiple ▁ of ▁ 5" ) NEW_LINE DEDENT