Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Programming introduction / Solutions Sem. 03 / 02. Sorted_Common_Divisors.cpp
blob: 62d01ce1963fadb6b7bf8ed8e498b9b5f2ff5711 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>

using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;

	for (int i = ((n < k) ? n : k); i > 0; i--)
	{
		if (n % i == 0 && k % i == 0)
			cout << i << " ";
	}
	cout << endl;
}