Skip to content

Commit b18c45a

Browse files
authored
Create duck number
1 parent 53ced77 commit b18c45a

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

duck number

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import java.util.Scanner;
2+
public class DuckNUMBER {
3+
public static void main(String[] args) {
4+
Scanner sc = new Scanner(System.in);
5+
int num = sc.nextInt();
6+
int rev = 0;
7+
int count = 0;
8+
int count2 = 0;
9+
for (int i = 1; i <= num; i++) {
10+
int num2 = num % i;
11+
if (num2 == 0) {
12+
count++;
13+
}
14+
}
15+
if (count == 2) {
16+
while (num != 0) {
17+
int num3 = num % 10;
18+
rev = rev * 10 + num3;
19+
num = num / 10;
20+
}
21+
System.out.println(+rev);
22+
for (int i = 1; i <= rev; i++) {
23+
int num4 = rev % i;
24+
if (rev % i == 0) {
25+
count2++;
26+
}
27+
}
28+
if (count2 == 2) {
29+
System.out.println(+rev + " : " + "is a twisted prime");
30+
}
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)