21.輸出9*9乘法口訣

編程題目:

21.輸出9*9乘法口訣。

示例代碼:

package program.calculation.exercise21;

/**
* 21.輸出9*9乘法口訣。
*/

public class MultiplyTable {
	public static void main(String[] args) {
		
		System.out.println("9*9乘法口訣如下:");
		for(int i=1; i<10; i++){
			for(int j=1; j<=i; j++) {
				System.out.print(j+"*"+i+"="+(j*i)+" ");
			}
			System.out.println();
		}
		
	}
}

結果顯示:

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章