Well, it is actually pretty easy; all you need is a loop and the mod block.
I didn't test this script, it's off the top of my head, but it should work.
set [num1 v] to [0] // The first number set [num2 v] to [0] // The second number if <(num1) > (num2)> set [dir v] to [1] else set [dir v] to [0] end repeat until <<<((num1) mod (num2)) = [0]> and <(dir) = [1]>> or <<((num2) mod (num1)) = [0]> and <(dir) = [0]>>> if <(dir) = [0]> set [num1 v] to ((num1) mod (num2)) set [dir v] to [1] else set [num2 v] to ((num2) mod (num1)) set [dir v] to [0] end end if <(dir) = [0]> set [answer v] to (num2) else set [answer v] to (num1) end
Offline
I made a mistake in the above script and reported it to be fixed since I can't edit yet. Sorry 'bout that, i switched the num1 and num2 reporters in the last if/else. If you see "last edited by" in italics at the bottom of the psot, it has been fixed.
Offline
Gravitation wrote:
I made a mistake in the above script and reported it to be fixed since I can't edit yet. Sorry 'bout that, i switched the num1 and num2 reporters in the last if/else. If you see "last edited by" in italics at the bottom of the psot, it has been fixed.
Why don't you make some projects to be a Scratcher?
[offtopic]Look at the text in red. TBG time! [/offtopic]
Offline