問題描述
1221是一個非常特殊的數(shù)衡奥,它從左邊讀和從右邊讀是一樣的描融,編程求所有這樣的四位十進(jìn)制數(shù)睹晒。
輸出格式
按從小到大的順序輸出滿足條件的四位十進(jìn)制數(shù)瓷胧。
public class 回文數(shù) {
public static void main(String[] args) {
for(int i = 1000;i<10000;i++) {
int one = i/1000;
int two = i%1000/100;
int three = i%100/10;
int four = i%10;
if(one == four && two==three)
System.out.println(i);
}
}
}