Home > Back-end >  Beginners Java, this program is to achieve output of palindrome prime Numbers, but if made a mistake
Beginners Java, this program is to achieve output of palindrome prime Numbers, but if made a mistake

Time:11-02

Package HHH.
import java.util.Scanner;
Import the Java. Math. *;
Public class tiji {
Static int b=0;
Public static int huiwen (int a) {
int i=0;
int sum=0;
Int record=a;
Int zk=0;
While (true)
{
I=a % 10;
Sum=sum * 10 + I;
A/=10;
If (a==0) break;
}
return sum;
}
Public static Boolean value (int x)
{int k=(int) Math. SQRT (x);
Boolean bool=false;
for(int i=2; i{
If (x % I==0)
{
break;
}
The else
Bool=true;

}
Return a bool.
}

Public static void main (String [] args) {
int num;
Int a=12;
Scanner sc=new Scanner (System. In);
Num=sc. NextInt ();
for(; BInt hui=huiwen (a);
If (b!=0 & amp; & B % 10==0)
System.out.println("");
If (value (a) & amp; & The value (hui)) {
System. The out. Print (a + "");
B++;
}
}

}
}


15 the palindrome 51 is a prime number, why would the output?
  • Related