Составьте программу нахождения наименьшего общего кратного (НОК) двух чисел, используя формулу:
А × В = НОД(А, В) × НОК(А, В).
Ответы на вопрос
Ответил sellsaccount
0
var a, b, c, d, i, n :integer;
procedure swap (a, b :integer; c, d :integer);
begin
if a>b then begin c:=a; d:=a; end
else begin c:=b; d:=a; end;
end;
begin
read (a, b);
swap(a, b, a, b);
for i:=1 to a do if (a mod i=0) and (b mod i=0) then c:=i;
write (a*b/c);
end.
procedure swap (a, b :integer; c, d :integer);
begin
if a>b then begin c:=a; d:=a; end
else begin c:=b; d:=a; end;
end;
begin
read (a, b);
swap(a, b, a, b);
for i:=1 to a do if (a mod i=0) and (b mod i=0) then c:=i;
write (a*b/c);
end.
Новые вопросы
Математика,
2 года назад
Математика,
10 лет назад