?? huiwen.java
字號:
import javax.swing.*;
import java.awt.*;
public class huiwen
{
public static void main(String []argv)
{
boolean flag = true;
while(flag)
{
String firstN = null;
int Number = 0,temp,size = 0;
int []a = new int [10];
firstN = JOptionPane.showInputDialog(firstN);
Number = Integer.parseInt(firstN);
temp = Number;
while(temp>0)
{
a[size] = temp%10;
temp/=10;
size++;
}
if(size!=5)
JOptionPane.showMessageDialog(null,"請輸入5位整數","Warning",JOptionPane.WARNING_MESSAGE);
else if (a[0]==a[4]&&a[1]==a[3])
{
JOptionPane.showMessageDialog(null,"此數是回文數","Information",JOptionPane.INFORMATION_MESSAGE);
flag = false;
}
else
{
JOptionPane.showMessageDialog(null,"此數不是回文數","Information",JOptionPane.INFORMATION_MESSAGE);
flag = false;
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -