-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmrip.java
More file actions
45 lines (42 loc) · 755 Bytes
/
Copy pathEmrip.java
File metadata and controls
45 lines (42 loc) · 755 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
34
35
36
37
38
39
40
41
42
43
44
45
import java.util.*;
public class Emrip
{
int n,rev,f;
Emrip(int nn)
{
n=nn;
rev=0;
f=2;
}
int isprime(int x)
{
if(x==f)
return 1;
else if(x%f==0)
return 0;
else if(f<x)
{
f++;
isprime(x);
}
return 1;
}
void isEmrip()
{
int a=n;
while(a>0)
{
rev=rev*10+(a%10);
a/=10;
}
if(isprime(n)==1&&isprime(rev)==1)
System.out.println("Number is Emrip");
else
System.out.println("Number is not Emrip");
}
public static void main(int na)
{
Emrip ob=new Emrip(na);
ob.isEmrip();
}
}