Почему? Надо было найти НОД(найбольший общий делитель)
Код:
Код: Выделить всё
var input,output:text;
n1,n2,d:real;
begin
assign(input,'input.txt'); reset(input);
assign(output,'output.txt'); rewrite(output);
readln(input,n1,n2);
if n1>=n2 then d:=n1;
if n2>=n1 then d:=n2;
while ((n1/d)trunc(n1/d)) and ((n2/d)trunc(n2/d)) do
d:=d-1;
writeln(output,trunc(d));
close(input);
close(output)
end.