Даны натуральные числа М и N. Определить их наименьшее общее кратное Nok — Pascal(Паскаль)

Program nodnok;
    uses crt;
var a, b: integer;
Function NOD(x,y:integer): integer;
begin
  if x<>0 then
    NOD:=NOD(y mod x,x)
  else
    NOD:=y;
end;
 
Function NOK(x,y:integer): integer;
begin
  NOK:=(x div NOD(x,y))*y;
end;
 
begin
  Writeln('vvedite pervoe cislo');
  Readln(a);
   Writeln('vvedite vtoroe cislo');
  Readln(b);
  Writeln('NOK  ',a,  'and'  ,b,'=',NOK(a,b));
  Readln;
end.

Leave a Comment

8 + 1 =