1. 程式人生 > >[Java] 藍橋杯 BASIC-8 基礎練習 迴文數

[Java] 藍橋杯 BASIC-8 基礎練習 迴文數

問題描述  1221是一個非常特殊的數,它從左邊讀和從右邊讀是一樣的,程式設計求所有這樣的四位十進位制數。輸出格式  按從小到大的順序輸出滿足條件的四位十進位制數。

package algorithm.Lanqiao.基礎練習;

public class base8 {

    public static void main(String[] args) {
        for (int i = 1; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                System.out.print(i);
                System.out.print(j);
                System.out.print(j);
                System.out.print(i);
                System.out.println();
            }

        }
    }

}