public static void main(String[] args){
Scanner scan = new Scanner(System.in);
System.out.println("请输入1~9数字:");
int n = scan.nextInt();
method(n);
}
public static void method(int n){
if(n < 1 || n > 9){
return;
}
for(int i = 1;i<=n;i++){
for(int j = 1;j<=i;j++){
System.out.print(j + "x" + i + "=" + (i*j) + "\t");
}
System.out.println();
}
}
键盘录入一个数据n(1<=n<=9),输出对应的nn乘法表
最新推荐文章于 2024-11-09 12:43:52 发布