aboutsummaryrefslogtreecommitdiff
path: root/tests/upload/gcd_recursive.sy
blob: fd09019281a9682a797247ce8d793df6885c26dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
int gcd(int a, int b){
    if(a == 0) return b;
    if(b == 0) return a;
    if(a > b)
        return gcd(a % b, b);
    else
        return gcd(a, b % a);
}

int main(){
    int a, b;
    int c;
    a = getint();
    b = getint();
    c = gcd(a, b);
    return c;
}