Website Summary Files Commits Branches @commit @diff @stats
path: root / Week07 / Exercise07.cpp
blob: 6bb2a8c5023ecd5c362bd1f846910ba74b8e8320 (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>

// Припомняме, че "unsigned" е същото като "unsigned int"
unsigned sumElems(int* arr, unsigned size) {
	int sum = 0;
	for (unsigned int i = 0; i < size; i++)
		sum += arr[i];
	return sum;
}

int main() {
	const unsigned int SIZE = 11;
	int input[SIZE];
	for (unsigned int i = 0; i < SIZE; i++)
		std::cin >> input[i];

	for (unsigned int i = 0; i <= SIZE - 3; i++) {
		if (sumElems(input + i, 3) == 0) {
			std::cout << input[i] << ' ' << input[i + 1] << ' ' << input[i + 2] << std::endl;
			return 0;
		}
	}

	return 0;
}