How to compute mod of a big number ? | Function to compute num ( mod a ) ; Initialize result ; One by one process all digits of 'num ; Driver program
def mod ( num , a ) : NEW_LINE INDENT res = 0 NEW_LINE DEDENT ' NEW_LINE INDENT for i in range ( 0 , len ( num ) ) : NEW_LINE INDENT res = ( res * 10 + int ( num [ i ] ) ) % a NEW_LINE DEDENT return res NEW_LINE DEDENT num = "12316767678678" NEW_LINE print ( mod ( num , 10 ) ) NEW_LINE