Răspuns:
#include <iostream>
using namespace std;
int main()
{
int a,i,p,nr1,nr2,d;
cin>>a;
i=a;
p=i%10;
x=i/10;
while(x!=0)
{
p=p*10+x%10;
x/=10;
}
nr1=1;
nr2=1;
d=2;
while(d<=a/2)
{ if(a%d==0)
nr1=0;d++;}
d=2;
while(d<=a/2)
{ if(p%d==p)
nr2=0;d++;}
if(nr1==1&&nr2==1)
cout<<"Numerele sunt prime";
else
cout<<"Numerele nu sunt prime";
return 0;
}