Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
364 B
0
Indexable
Never
#include <iostream>

using namespace std;

int main() {
	int arr[100];
	int a;
	int q = 0;
	int index;

	for (int i = 0; i < 100; i++) {
		cin >> a;
		if (a == -1)break;
		arr[i] = a;
		q += 1;
	}
	if (q % 2 != 0) {
		index = (q + 1) / 2;
		cout << arr[index];
	}
	else {
		index = q / 2;
		cout << arr[index] + arr[index + 1];
	}

}


Leave a Comment