Website Summary Files Commits Branches @commit @diff @stats
path: root / Week06 / Exercise09.cpp
blob: 80d126c8d2c71cdde5169f401f1ee3ec44b3bdb2 (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
#include <iostream>

int main() {
	const unsigned int SIZE = 10;
	int numbers[SIZE];

	for (int i = 0; i < SIZE; i++)
		std::cin >> numbers[i];

	bool found = false;
	for (int i = 0; i < SIZE && !found; i++) {
		for (int j = i + 1; j < SIZE && !found; j++) {
			for (int k = j + 1; k < SIZE && !found; k++) {
				found = numbers[i] + numbers[j] + numbers[k] == 0;
			}
		}
	}

	if (found)
		std::cout << "Exists" << std::endl;
	else
		std::cout << "Doesn't exist" << std::endl;

	return 0;
}