var a,b: integer;
begin
readln(a,b);
while (a<>0)and(b<>0) do
if a>b then a:=a mod b
else b:=b mod a;
writeln('НОД = ',a+b);
end.
Пример:
125 50
НОД = 25
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
var a,b: integer;
begin
readln(a,b);
while (a<>0)and(b<>0) do
if a>b then a:=a mod b
else b:=b mod a;
writeln('НОД = ',a+b);
end.
Пример:
125 50
НОД = 25