.


- 4


writeln(' t - '); goto 1 end;

if (a*x + b*y = 1) and (a > 0) and (b < 0)

then begin writeln(' x = ', x, ' ', b,'*t, y = ', y, '-', a, '*t,');

writeln(' t - '); goto 1 end;

if (a*x + b*y = 1) and (a < 0) and (b < 0)

then begin writeln(' x = ', x, ' ', b,'*t, y = ', y, ' ', a, '*t,');

writeln(' t - '); goto 1 end

end;

1: end;

+ by = 1 :

Program Problem5;

uses WinCrt;

var

a, b : integer;

{---------------------------------------------------------------------------------------------------------}

Function nod(a, b : integer) : integer;

begin

if b = 0 then nod := abs(a)

else nod := nod(abs(b), abs(a) mod abs(b))

end;

{----------------------------------------------------------------------------------------------------------}

Procedure

The_equation(a, b : integer); { ax + by = 1}

label 1;

var

max, x, y, n : integer;

begin

if (nod(a, b) <> 1) then

writeln(' ');

if abs(a) > abs(b) then

max := abs(a) else max := abs(b);

for x := -max to max do

for y := -max to x do

begin

if (a*x + b*y = 1) and

(a > 0) and (b > 0)

then begin writeln(' x = ', x, '+', b,'*t, y = ', y, '-', a, '*t,');

writeln(' t - '); goto 1 end;

if (a*x + b*y = 1) and (a < 0) and (b > 0)

then begin writeln(' x = ', x, '+', b,'*t, y = ', y, ' ', a, '*t,');

writeln(' t - '); goto 1 end;