import java.util.Scanner;
import java.lang.Integer;
public class primeAdam
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int m,n,i,j,x=0,y,z,rev;
System.out.println("enter m val");
m=sc.nextInt();
System.out.println("enter n val");
n=sc.nextInt();
while(m>n)
{
System.out.println("not valid.. try again");
System.out.println("enter m val");
m=sc.nextInt();
System.out.println("enter n val");
n=sc.nextInt();
}
sc.close();
System.out.println("the prime-adam no.s within the range is ");
if(m>10)
m=10;
for(i=m;i<n;i++)
{
for(j=1;j<=i;i++)
{
if(i%j==0)
x++;
}
if(x==2)
continue;
y=Integer.reverse(i);
z=i*i;
rev=y*y;
if(z==Integer.reverse(rev))
System.out.print(i+" ");
}
}
}
the aim of the program is to check if a. the no. is prime and b. is the no. when squared and reversed is equal to the original no when squared




