public class liucheng_1 { public static void main(String args[]) { for(int hang=1;hang<=9;++hang) { for(int lie=1;lie<=hang;++lie) { if(lie*hang<10) { System.out.print(‘ ‘);//对齐 } System.out.print((lie*hang)+" "); } System.out.println(); } } }
结果如下:
--------------------Configuration: <Default>-------------------- 1 2 4 3 6 9 4 8 12 16 5 10 15 20 25 6 12 18 24 30 36 7 14 21 28 35 42 49 8 16 24 32 40 48 56 64 9 18 27 36 45 54 63 72 81 Process completed.
时间: 2024-10-21 06:38:22