Ok i understand it more clearly now. in Perl and Python has maths libraries with correctly designed mod functions but languages like C/C++ and Java doesnot have. Can you tell me what strategy should I follow to correct my output in c/c++ and java ?

thanks