0% found this document useful (0 votes)
2 views

import jav1

The Java program checks if a given number is an emirp number, which is a prime number that remains prime when its digits are reversed. It first counts the divisors of the input number to determine if it is prime, then reverses the number and checks if the reversed number is also prime. If both conditions are met, it prints 'Emirp number'; otherwise, it prints 'Not emirp number'.

Uploaded by

ghostofekn123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

import jav1

The Java program checks if a given number is an emirp number, which is a prime number that remains prime when its digits are reversed. It first counts the divisors of the input number to determine if it is prime, then reverses the number and checks if the reversed number is also prime. If both conditions are met, it prints 'Emirp number'; otherwise, it prints 'Not emirp number'.

Uploaded by

ghostofekn123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

import java.util.

Scanner;

public class emirp

public static void main()

Scanner in=new Scanner(System.in);

System.out.print("Enter Number: ");

int num=in.nextInt();

int c=0;

for (int i=1;i<=num;i++)

if(num%i==0)

c++;

if (c==2)

int t=num;

int revNum=0;

while(t!=0)

int digit=t%10;

t/=10;

revNum=revNum*10+digit;
}

int c2=0;

for(int i=1;i<=revNum;i++)

if(revNum%i==0)

c2++;

if(c2==2)

System.out.println("Emirp number");

else

System.out.println("Not emirp number");

else

System.out.println("Not emirp number");

Enter Number: 9

Not emirp number

You might also like