Why can't we solve multiplicative inverse problem using extended Euclid method?

I was solving the multiplicative inverse problem.

It was asking to calculate the multiplicative modulo inverse.

I was trying to solve the question with the extended Euclid method.

Only 2 test cases got cleared.

I am not able to figure your mistakes in my code.

My code link: https://ide.codingblocks.com/s/242221

@siddharth_1_3277
Check line no. 61, It should be cout<<(x+b)<<endl;
Do this change, all testcases will pass

Yeah, it is working now. Thanks