Website Summary Files Commits Branches @commit @diff @stats
path: root / Week06 / Exercise17.cpp
blob: b308f1dacdd34801418fa5f4363667db806b8333 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
}