summaryrefslogtreecommitdiff
path: root/3808/CH4/EX4.13/Ex4_13.sce
diff options
context:
space:
mode:
Diffstat (limited to '3808/CH4/EX4.13/Ex4_13.sce')
-rw-r--r--3808/CH4/EX4.13/Ex4_13.sce18
1 files changed, 18 insertions, 0 deletions
diff --git a/3808/CH4/EX4.13/Ex4_13.sce b/3808/CH4/EX4.13/Ex4_13.sce
new file mode 100644
index 000000000..3f0b75d2b
--- /dev/null
+++ b/3808/CH4/EX4.13/Ex4_13.sce
@@ -0,0 +1,18 @@
+//Chapter 04:Number Theory and Cryptography
+
+clc;
+clear all;
+
+//GCD using recursion
+function f=gcd(n,m)
+ if (n>=m) & (modulo(n,m)==0) then
+ f=m
+ else
+ f=gcd(m,modulo(n,m))
+ end
+endfunction
+
+a=input("Number 1:")
+b=input("Number 2:")
+ann=gcd(a,b)
+mprintf("GCD(%d,%d) is:%d",a,b,ann)