Code Below:


import java.util.*;
class palprime
{
    public static void main()
    {
        Scanner s=new Scanner(System.in);
        int n,i,c=0,a,copy,r=0;
        System.out.println("enter a no.");
        n=s.nextInt();
        copy=n;
        for (i=1;i<=n;i++)
        if(n%i==0)
        c++;
        while(copy>0)
        {
            a=copy%10;
            r=(r*10)+a;
            copy=copy/10;
        }
        if(r==n && c==2)
        System.out.println("pal prime");
        else
        System.out.println("not pal prime");
    }
}