Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
544 B
1
Indexable
Never
#include <iostream>
using namespace std;
int main()
{
	int mas1[100];
	int mas2[100];
	int mas3[100];
	int n;
	cin >> n;
	int a = 0;
	int b = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> mas1[i];

		if (mas1[i] % 2 == 0)
		{
			mas2[a] = mas1[i];
			a++;
		}
		if (mas1[i] % 2 != 0)
		{
			mas3[b] = mas1[i];
			b++;
		}
	}
	if (a > b)
	{
		for (int i = 0; i < a; i++)
		{
			cout << mas2[i] << endl;
		}
	}
	if (a < b)
	{
		for (int i = 0; i < b; i++)
		{
			cout << mas3[i] << endl;
		}
	}
	return 0;
}
Leave a Comment