Permalink
Browse files

Add Euclidean algorithm for test interpretation.

  • Loading branch information...
1 parent 9cf6144 commit 7b9d197fb2b886362a6561ca76f0ee956487964f @Totktonada committed May 8, 2012
Showing with 20 additions and 0 deletions.
  1. +20 −0 scripts/EuclideanAlgorithm.script
@@ -0,0 +1,20 @@
+set $a 2*2*13*17*11;
+set $b 2*2*13*17*13*19;
+
+if ($a == 0) {
+ set $res $b;
+ goto @res;
+}
+
+while (!($b == 0)) {
+ if ($a > $b) {
+ set $a $a - $b;
+ } else {
+ set $b $b - $a;
+ }
+}
+
+set $res $a;
+
+@res:
+print("GCD: ", $res, "; expected: ", 2*2*13*17);

0 comments on commit 7b9d197

Please sign in to comment.