Advertisement
Racknoss

NOD function

May 28th, 2015
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.19 KB | None | 0 0
  1. function NOD(a,b:int64):int64;
  2. label 1;
  3. begin
  4. result:=0;
  5. repeat
  6.  a:=a mod b;
  7.  if a=0 then begin Result:=b; goto 1; end;
  8.  b:=b mod a;
  9.  1:if b=0 then Result:=a;
  10. until(result>0);
  11. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement