Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fun gcd(x,y) = let val p_x= ref x; val p_y = ref y; val temp = ref 0 in
- while not (!p_x = !p_y) do
- (if (!p_x > !p_y) then (temp := !p_x; p_x := !p_y ; p_y := (!temp - !p_y)) else p_y := (!p_y - !p_x));
- !p_x
- end;
Add Comment
Please, Sign In to add comment