Răspuns :
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("HAHA.txt");
ofstream fout("HIHI.txt");
int i,n,j,k,aux,x,v[1000],w[101],s;
int main()
{
for (i=1;i<=100;i++)
{
fin>>x;
v[x]++;
aux=x;
k=1;
s=s+x%10;
while (aux/10)
{
if (aux%10%2!=aux/10%10%2)
k=0;
aux/=10;
}
if (k)
{
j++;
w[j]=x;
}
}
cout<<"a)."<<endl<<x;
cout<<endl;
cout<<"b)."<<endl;
for (i=1;i<=j;i++)
{
cout<<w[i]<<" ";
}
if (j==0)
cout<<"NU EXISTA";
cout<<endl;
for (i=100;i<=999;i++)
if (v[i]>=3)
fout<<i<<" ";
cout<<"d)."<<endl;
cout<<s;
}
#include <fstream>
using namespace std;
ifstream fin("HAHA.txt");
ofstream fout("HIHI.txt");
int i,n,j,k,aux,x,v[1000],w[101],s;
int main()
{
for (i=1;i<=100;i++)
{
fin>>x;
v[x]++;
aux=x;
k=1;
s=s+x%10;
while (aux/10)
{
if (aux%10%2!=aux/10%10%2)
k=0;
aux/=10;
}
if (k)
{
j++;
w[j]=x;
}
}
cout<<"a)."<<endl<<x;
cout<<endl;
cout<<"b)."<<endl;
for (i=1;i<=j;i++)
{
cout<<w[i]<<" ";
}
if (j==0)
cout<<"NU EXISTA";
cout<<endl;
for (i=100;i<=999;i++)
if (v[i]>=3)
fout<<i<<" ";
cout<<"d)."<<endl;
cout<<s;
}