forked from ghostmkg/programming-language
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmirp.java
More file actions
33 lines (31 loc) · 660 Bytes
/
Emirp.java
File metadata and controls
33 lines (31 loc) · 660 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.util.*;
class Emirp
{
public static void main()
{
Scanner sc=new Scanner(System.in);
int n,c=0,c2=0,r=0,i,c1;
System.out.println("Enter no.");
n=sc.nextInt();
for(i=1;i<=n;i++)
{
if(n%i==0)
c++;
}
while(n>0)
{
c1=n%10;
r=r*10+c1;
n=n/10;
}
for(i=1;i<=r;i++)
{
if(r%i==0)
c2++;
}
if(c==2 && c2==2)
System.out.println("Yes Emirp");
else
System.out.println("Not Emirp");
}
}