You are viewing a single comment's thread. Return to all comments →
Erlang solution:
main() -> [Q,W] = string:split(io:get_line(""), " "), {A, _} = string:to_integer(Q), {B, _} = string:to_integer(W), GCD = fun F(X,Y) -> case X-Y =:= 0 of false -> ((X - Y > Y) andalso F(X-Y,Y)) orelse F(Y, X-Y); true -> io:fwrite("~p",[Y]), true end end, ((A > B) andalso GCD(A,B)) orelse GCD(B,A).
Seems like cookies are disabled on this browser, please enable them to open this website
Computing the GCD
You are viewing a single comment's thread. Return to all comments →
Erlang solution: