//用键盘录入的方式在控制台输出九九乘法表。
import java.util.Scanner;
class Practise3_99 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入一个1~9之间的整数");
int a = sc.nextInt();
if (a >= 1 && a <9){
for (int x = 1;x <= a ;x++ ){
for (int y = 1;y <= x ;y++ ){
System.out.print(y + "*" + x + "=" + (y * x) + "\t");
}
System.out.println();
}
}else {
System.out.println("超出范围");
}
}
}
|
|