aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/79_gcd.sy
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/79_gcd.sy')
-rw-r--r--tests/functional/79_gcd.sy34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/functional/79_gcd.sy b/tests/functional/79_gcd.sy
new file mode 100644
index 0000000..1d20bc5
--- /dev/null
+++ b/tests/functional/79_gcd.sy
@@ -0,0 +1,34 @@
+int n;
+
+int gcd(int m,int n)
+{
+ int t;
+ int r;
+
+ if(m<n) { t=m;m=n;n=t; }
+
+ r=m%n;
+
+ while(r!=0)
+ {
+ m=n;
+ n=r;
+ r=m%n;
+ }
+
+ return n;
+
+}
+
+int main()
+{
+ //newline=10;
+ int i;
+ int m;
+ //m = 1478;
+ //int t;
+ i=getint();
+ m=getint();
+
+ return gcd(i,m);
+} \ No newline at end of file