Untitled
unknown
c_cpp
2 years ago
522 B
8
Indexable
#include <iostream>
int main()
{
long long chet[100];
long long neChet[100];
int countChet = 0, countNeChet= 0 ;
long long 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