Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { ЗАДАНИЕ №1 }
- procedure NodNok(a, b: integer);
- var
- pr, nod, a1, b1: integer;
- begin
- if (a <= 0) or (b <= 0) then
- begin
- ExtraExit('Write entire nonzero number!');
- end;
- pr := a * b;
- a1 := a;
- b1 := b;
- while a * b <> 0 do
- if a > b then
- a := a mod b
- else
- b := b mod a;
- nod := a + b;
- writeln('NOD of numbers ', a1, ' and ', b1, ' equals ', nod,
- ', and their NOK equals ', pr div nod);
- end;
- { ЗАДАНИЕ №1 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement