gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
expanded sample size, first version
[mjc2wsl.git] / samples / alpha-mj-exp / gcd-rek-predef-m3.mj
diff --git a/samples/alpha-mj-exp/gcd-rek-predef-m3.mj b/samples/alpha-mj-exp/gcd-rek-predef-m3.mj
new file mode 100644 (file)
index 0000000..0b0a011
--- /dev/null
@@ -0,0 +1,18 @@
+program RekGCD{
+
+       int gcd(int a, int b)
+       {
+               if (a>b) 
+                       return gcd(a-b,b);
+               if (a<b)
+                       return gcd(a,b-a);
+               return a;
+       }
+       
+       void main()
+       {
+               print(gcd(8,12),3);
+               print(gcd(9,31),3);
+               print(gcd(164,88),3);
+       }
+}
\ No newline at end of file
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner