# find the GCD of two input numbers
gcd <- function(x, y) {
    # choose the smaller number
    if(x > y) {
        smaller = y
    } else {
        smaller = x
    }

    for(i in 1:smaller) {
        if((x %% i == 0) && (y %% i == 0)) {
            gcd = i
        }
    }
    return(gcd)
}

# take input from the user
num1 = 10
num2 = 24

print(paste("The G.C.D. of", num1,"and", num2,"is", gcd(num1, num2)))

