/*
* A:案例演示
* 需求:根據鍵盤錄入的資料輸出對應的乘法表
*/
import java.util.Scanner;
class Test2_Method {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);//創建鍵盤錄入物件
System.out.println("請錄入一個整數,範圍在1-9之間");
int num = sc.nextInt();//將鍵盤錄入的整數存儲在num中
print99(num);
}
/*
列印99乘法表
1,返回數值型別void
2,參數列表,int a
*/
public static void print99(int a) {
for (int i = 1;i <= a ;i++ ) {//行數
for (int j = 1;j <= i ;j++ ) {//列數
System.out.print(j + "*" + i + "=" + (i * j) + " " );
}
System.out.println();
}
}
}