Răspunsuri

2014-03-31T14:40:45+03:00
#include<iostream>
using namespace std;
int main(){int i,j,n,a[100],b[100],k,x=0,y;
cin>>n;
for(i=1;i<=n;i++){cin>>a[i];}
for(i=1;i<=n;i++){y=a[i];k=0;for(j=1;j<=y;j++){if(y%j==0){k++;}}
if(k==2){x++;b[x]=y;}}
for(i=1;i<=x;i++){cout<<b[i]<<" ";}}

2 5 2