Răspuns:
#include <iostream>
using namespace std;
int prim(int n){
if(n<2)
return 0;
if(n==2)
return 1;
else if(n%2==0 && n>2)
return 0;
else for(int i=3;i*i<=n;i+=2)
if(n%i==0)
return 0;
return 1;
}
int main(){
int a,b;
cin>>a>>b;
for (int i=a;i<=b;i++)
if(prim(i))
cout<<i<<" ";
return 0;
}