Modular Exponentiation 2 by uru

begin
repeat
var a,b,c,r:comp=1;read(a,b,c);repeat
if 1and b>0then r:=r*a mod c;a:=a*a mod c;shr(b,1)until b=0;writeln(r)until 1=0end.

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page