public static void main(String[] args) {
String inputValue = JOptionPane.showInputDialog("请输入一个整数");
long inputValueLong = Long.parseLong(inputValue);
long temp = inputValueLong;
long reverseLong = 0L;
while(inputValueLong != 0)
{
reverseLong = reverseLong*10+inputValueLong%10;
inputValueLong = inputValueLong/10;
}
if(reverseLong == temp)
System.out.println("你输入的是回文数");
else
System.out.println("你输入的不是回文数");
}
判断是否是回文数
最新推荐文章于 2021-05-17 22:18:33 发布