Multiplicative modulo inverse

what is the error in the following code:

@drishti307
Your code for calculating power is wrong
You can set mod to 5 and input 2
It should output 2^3 which is 8 but your code gave 3
Please see the correct code for that

If your doubt is resolved please mark it as closed