Website Summary Files Commits Branches @commit @diff @stats
path: root / Week06 / Exercise17.cpp
diff options
context:
space:
mode:
1 files changed, 19 insertions, 0 deletions
-rw-r--r--Week06/Exercise17.cpp19
diff --git a/Week06/Exercise17.cpp b/Week06/Exercise17.cpp
new file mode 100644
index 0000000..b308f1d
--- /dev/null
+++ b/Week06/Exercise17.cpp
@@ -0,0 +1,19 @@
+#include <iostream>
+
+int main() {
+ unsigned int a, b;
+ std::cin >> a >> b;
+
+ unsigned int c = b / a, gcd = c;
+ // Към какво може да се опрости долния булев израз?
+ while (!(a % gcd == 0 && c % gcd == 0)) {
+ gcd--;
+ }
+
+ if (b % a == 0 && gcd == 1)
+ std::cout << "Unitary divisor" << std::endl;
+ else
+ std::cout << "Not a unitary divisor" << std::endl;
+
+ return 0;
+}