Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
1 files changed, 30 insertions, 0 deletions
-rw-r--r--homework/61984/HW3/main.cpp30
diff --git a/homework/61984/HW3/main.cpp b/homework/61984/HW3/main.cpp
new file mode 100644
index 0000000..7696fe7
--- /dev/null
+++ b/homework/61984/HW3/main.cpp
@@ -0,0 +1,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;
+}