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-input.mj
diff --git a/samples/alpha-mj-exp/gcd-rek-input.mj b/samples/alpha-mj-exp/gcd-rek-input.mj
new file mode 100644 (file)
index 0000000..20d067a
--- /dev/null
@@ -0,0 +1,24 @@
+program rekgcdinput{
+
+       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()
+               int a;
+               int b;
+       {
+               print('a');
+               print('?');
+               read(a);
+               print('b');
+               print('?');
+               read(b);
+               print(gcd(a,b),3);
+       }
+}
\ No newline at end of file
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner