program table_euclid_algo;
var
b,a,r,q:array of integer;
i,x,y:integer;
begin
setLength(b,100);
setLength(a,100);
setLength(r,100);
setLength(q,100);
readln(x,y);
a[0]:=1;
b[0]:=0;
r[0]:=x;
q[0]:=0;
a[1]:=0;
b[1]:=1;
r[1]:=y;
q[1]:=x div y;
i:=1;
while r[i]<>1 do
begin
i:=i+1;
a[i]:=a[i-2]-q[i-1]*a[i-1];
b[i]:=b[i-2]-q[i-1]*b[i-1];
r[i]:=r[i-2] mod r[i-1];
q[i]:=r[i-1] div r[i];
end;
writeln('the values of x and y are ',a[i],' ',b[i]);
end.
cHJvZ3JhbSB0YWJsZV9ldWNsaWRfYWxnbzsKdmFyCmIsYSxyLHE6YXJyYXkgb2YgaW50ZWdlcjsKaSx4LHk6aW50ZWdlcjsKYmVnaW4KCXNldExlbmd0aChiLDEwMCk7CglzZXRMZW5ndGgoYSwxMDApOwoJc2V0TGVuZ3RoKHIsMTAwKTsKCXNldExlbmd0aChxLDEwMCk7CglyZWFkbG4oeCx5KTsKCWFbMF06PTE7CgliWzBdOj0wOwoJclswXTo9eDsKCXFbMF06PTA7CgkKCWFbMV06PTA7CgliWzFdOj0xOwoJclsxXTo9eTsKCXFbMV06PXggZGl2IHk7CglpOj0xOwoJd2hpbGUgcltpXTw+MSBkbwoJYmVnaW4KCQlpOj1pKzE7CgkJYVtpXTo9YVtpLTJdLXFbaS0xXSphW2ktMV07CgkJYltpXTo9YltpLTJdLXFbaS0xXSpiW2ktMV07CgkJcltpXTo9cltpLTJdIG1vZCByW2ktMV07CgkJcVtpXTo9cltpLTFdIGRpdiByW2ldOwoJZW5kOwoJd3JpdGVsbigndGhlIHZhbHVlcyBvZiB4IGFuZCB5IGFyZSAnLGFbaV0sJyAnLGJbaV0pOwplbmQuCg==
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
30 lines compiled, 0.0 sec
the values of x and y are -9 47