summaryrefslogtreecommitdiff
path: root/3808/CH4/EX4.15/Ex4_15.sce
blob: 894d8d0408de476f514f3f815a7c4040adf0a957 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//Chapter 04:Number Theory and Cryptography

clc;
clear all;

//To find the GCD using euclidean algorithm

function gcd(a,b)
    x=a
    y=b
    while y ~=0
        r=modulo(x,y)
        x=y
        y=r
    end
mprintf("GCD(%d,%d) = %d",a,b,x)
endfunction

n1=input("Enter 1st Number:")
n2=input("Enter 2nd Number:")
gcd(n1,n2)