Program tapsirmaC;var a,b,n,x,p:integer; input,output:text;beginp:=0;assign(input,'c.in');assign(output,'c.out');reset(input);rewrite(output);read(input,a,b,n);for x:= 1 to n dobeginif a*x mod n = b then p:=p+1;end; write(output,p);close(input); close(output); end.
Program tapsirmaC; var a,b,n,x,p:integer; input,output:text; begin p:=0; assign(input,'c.in'); assign(output,'c.out'); reset(input); rewrite(output); read(input,a,b,n); for x:= 1 to n do begin if a*x mod n = b then p:=p+1; end; write(output,p); close(input); close(output); end.
tapsirmaC;
var
a,b,n,x,p:integer;
input,output:text;
begin
p:=0;
assign(input,'c.in');
assign(output,'c.out');
reset(input);
rewrite(output);
read(input,a,b,n);
for x:= 1 to n do
begin
if a*x mod n = b
then
p:=p+1;
end;
write(output,p);
close(input);
close(output);
end.