Untitled

 avatar
unknown
c_cpp
2 years ago
504 B
2
Indexable
#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] << " ";
		}
	}
}
Editor is loading...
Leave a Comment