Răspuns:
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("date.in");
int n,i,j,gasit, a[102],r,b;
int main()
{
f >> n;
for (i=1; i<=n; i++)
{
f >> a[i];
}
for (i=1; i<n; i++)
{
b=a[i]%2;
for (j=i+1; j<=n; j++)
{
r=b+a[j]%2;
if (r==0 || r==2)
{
gasit=1;
cout << a[i] << " " << a[j] << endl;
}
}
}
if (!gasit) cout << 0;
return 0;
}
Explicație: