program recursion_euclidalgo;
var
y1:integer;
function receuclid(var a,b:integer):integer;
var
q,r,y,y2,x:integer;
begin
if(b=0) then
begin
receuclid:=0;
y1:=1;
exit;
end;
q:=a div b;
r:=a mod b;
y:=receuclid(b,r);
x:=y1;
y2:=x-y*q;
y1:=y;
receuclid:=y2;
end;
var
i,x,y:integer;
begin
readln(x,y);
i:=receuclid(x,y);
writeln('the values of x and y are ',y1,' ',i);
end.
cHJvZ3JhbSByZWN1cnNpb25fZXVjbGlkYWxnbzsKdmFyIAp5MTppbnRlZ2VyOwpmdW5jdGlvbiByZWNldWNsaWQodmFyIGEsYjppbnRlZ2VyKTppbnRlZ2VyOwp2YXIgCnEscix5LHkyLHg6aW50ZWdlcjsKYmVnaW4KCWlmKGI9MCkgdGhlbgoJYmVnaW4KCXJlY2V1Y2xpZDo9MDsKCXkxOj0xOwoJZXhpdDsKCWVuZDsKCXE6PWEgZGl2IGI7CglyOj1hIG1vZCBiOwoJeTo9cmVjZXVjbGlkKGIscik7Cgl4Oj15MTsKCXkyOj14LXkqcTsKCXkxOj15OwoJcmVjZXVjbGlkOj15MjsKCQplbmQ7CnZhciAKaSx4LHk6aW50ZWdlcjsKYmVnaW4KCXJlYWRsbih4LHkpOwoJaTo9cmVjZXVjbGlkKHgseSk7Cgl3cml0ZWxuKCd0aGUgdmFsdWVzIG9mIHggYW5kIHkgYXJlICcseTEsJyAnLGkpOwplbmQuCg==
Free Pascal Compiler version 2.2.0 [2009/11/16] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Linux for i386
Compiling prog.pas
Linking prog
29 lines compiled, 0.0 sec
the values of x and y are -9 47