Website Summary Files Commits Branches @commit @diff @stats
path: root / homework / 61984 / HW3 / main.cpp
blob: 7696fe79ea159f769765d41c5872995456fbc19e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>
int gcd(int a, int b)
{
    __asm
    {
        mov eax, a
        mov ecx, b
    loop1: 
        cmp eax, ecx
        je end
        jg suba
        jmp subb
        
    suba:
        sub eax, ecx; 
        jmp loop1; 
        
    subb:
        sub ecx, eax
        jmp loop1

    end:
    }
}

int main()
{
    std::cout << gcd(21, 5);
    return 0;
}