What's wrong with the code?

cout<<(a^b)%c<<"\n";

This will not work.
a^b means a xor b in C++.
You have to find a to the power b. Then modulo c.

Refer this