As by given algorithm (a/b)%c = ((a%c)*((b^-1)%c))%c
but for example (9999/99)%9 = 2 , but by given algorithm it turn out to be 0.
this algorithm is based on the below link. https://www.hackerearth.com/practice/math/number-theory/basic-number-theory-1/tutorial/#c85200
please provide another algorithm apart from mentioned above as it is giving wrong answer for cases as i mentioned above.