FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-Programs/CircularPrime.java at master · Scarlet-Coder/Java-Programs · GitHub
Scarlet-Coder
/
Java-Programs
Public
forked from
codec-akash/DSA-PS-Java-Programs
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java-Programs
/
CircularPrime.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
57 lines (54 loc) · 1.02 KB
Breadcrumbs
Java-Programs
/
CircularPrime.java
Copy path
File metadata and controls
57 lines (54 loc) · 1.02 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
46
47
48
49
50
51
52
53
54
55
56
57
/ *
Find
if
a
number
is
circular
prime
or
not
.
*/
class
CircularPrime
{
boolean
isPrime
(
int
m
)
{
int
c
=
0
;
for
(
int
i
=
1
;
i
<
m
;
i
++)
{
if
(
m
%
i
==
0
)
c
++;
}
if
(
c
==
1
)
return
true
;
else
return
false
;
}
int
countDigits
(
int
n
)
{
int
c
=
0
;
while
(
n
>
0
)
{
n
=
n
/
10
;
c
++;
}
return
c
;
}
void
main
(
int
num
)
{
int
n
=
num
;
int
c
=
countDigits
(
num
);
int
f
=
0
;
int
t
=
0
;
int
p
=
1
;
for
(
int
i
=
1
;
i
<
c
;
i
++)
{
p
=
p
*
10
;
}
while
(
t
!=
num
)
{
t
=
n
%
p
;
int
j
=
n
/
p
;
t
=
t
*
10
+
j
;
boolean
r
=
isPrime
(
t
);
if
(
r
==
false
)
f
++;
n
=
t
;
}
if
(
f
==
0
)
System
.
out
.
println
(
num
+
" is a circular prime number"
);
else
System
.
out
.
println
(
num
+
" is not a circular prime number "
);
}
}
Back
|
FazBrowse Home
|
New Git URL