import java.util.Scanner;
public class huiwenshu {
public static void main(String[] args) {
int x, y, u, z, num = 0;
Scanner sc1 = new Scanner(System.in);
System.out.print("请输入数字 ");
x = sc1.nextInt();
u=x;
while (num!= u)
{
while (x != 0)
{
y = x % 10;
x = x / 10;
num = num * 10 + y;
}
if (num == u)
{
System.out.println("你输入的是回文数");
}
else
{
System.out.println("你输入的不是回文数");
System.out.println("请重新输入");
x = sc1.nextInt();
num=0;
u=x;
while (x != 0)
{
y = x % 10;
x = x / 10;
num = num * 10 + y;
}
}
System.out.println("你输入的是回文数");
回文数(java)
最新推荐文章于 2024-10-06 20:06:52 发布