Pagini recente » Cod sursa (job #988363) | Cod sursa (job #2794693) | Cod sursa (job #1819121) | Cod sursa (job #1022806) | Cod sursa (job #145072)
Cod sursa(job #145072)
program cmmdc;
var a,b,r:int 64;
procedure citire;
begin
assign(input,'euclid2.in');
reset(input);
read(a,b);
close(input);
end;
procedure cmmdc;
var w,q:int 64;
begin
w:=a;
q:=b;
repeat
r:=w mod q;
w:=q;
q:=r;
until q=0;
if (w=1) and (a<>1) and (b<>1) then
write(0)
else write(w);
end;
begin
citire;
assign(output,'euclid2.out');
rewrite(output);
cmmdc;
close(output);
end.