Untitled

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

int main()
{
	int chet[100];
	int neChet[100];
	int countChet = 0, countNeChet= 0 ;
	int a;
	for (int i = 0; i < 100; i++) {
		std::cin >> a;
		if (a % 2 == 0) {
			countChet += 1;
			chet[i] = a;
		}else{
			countNeChet += 1;
			neChet[i] = a;
		}
	}
	if (countChet > countNeChet) {
		for (int i = 0; i < countChet; i++) {
			std::cout << chet[i] << " ";
		}
	}
	else {
		for (int i = 0; i < countNeChet; i++) {
			std::cout << neChet[i] << " ";
		}
	}
}
Leave a Comment