Computer Science, asked by anshumanrajManjhi, 1 year ago

can anyone write a program to display palprime number in java loop

Answers

Answered by ayush686
2
++;
        }
        if(c==2)
            return true;
        else
            return false;
    }

    public boolean palindrome(int n)
    {
        int rev=0,temp=n;
        while(temp!=0)
        {
            rev=rev*10+(temp%10);
            temp=temp/10;
        }
        if(rev==n)
            return true;
        else
            return false;
    }

    public static void main(String args[])
    {
        Scanner ob=new Scanner(System.in);
        System.out.println("Enter number to be checked");
        int num=ob.nextInt();
        PalPrime obj=new PalPrime();
        if(obj.prime(num)==true && obj.palindrome(num)==true)
            System.out.println(num+" is a Prime Palindrome i.e. a PalPrime Number");
        else
            System.out.println(num+" is not a PalPrime Number");
    }
}

anshumanrajManjhi: Thanks
anshumanrajManjhi: can you explain
ayush686: yes
ayush686: which thing you are not understanding
Tusharbhardwaj: what is palprime no
Similar questions