complex3.cminus 324 Bytes
Newer Older
lxq's avatar
lxq committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
int gcd(int u, int v) {
    if (v == 0)
        return u;
    else
        return gcd(v, u - u / v * v);
}

void main(void) {
    int x;
    int y;
    int temp;
    x = input();
    y = input();
    if (x < y) {
        temp = x;
        x = y;
        y = temp;
    }
    temp = gcd(x, y);
    output(temp);
    return;
}