Răspuns:
#include<iostream>
#include<fstream>
using namespace std;
ifstream fcin("date.in");
ofstream fcout("date.out");
int n,i,x,c,d,p,k;
int main()
{
fcin>>n;
for(i=1;i<=n;i++)
{
fcin>>x;
c=x;
d=2;
p=0;
k=0;
while(x>1)
{
p=0;
while(x%d==0)
{
p++;
x/=d;
}
if(p)k++;
d++;
if(x>1 && d*d>x)d=x;
}
if(k==4)fcout<<c<<" ";
}
}
Explicație: