package liu.dh.java;
import java.util.Scanner;
public class Test11 {
/**
* @param args
* 根据键盘录入的数据输出对应的乘法表
* 1*1=1
* 2*1 2*2
* 3*1 3*2 3*3
* 4*1 4*2 4*3 4*4
*
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
System.out.println("请输入1-9之间的数字");
int a = sc.nextInt();
print(a);
}
public static void print(int x){
for (int i = 1; i <=x; i++) {
for (int j = 1; j <=i ; j++) {
int temp = i*j;
System.out.print(i+"*"+j+"="+temp+"\t");
}
//System.out.println('\'');
System.out.println("\"");//println换行,转意字符\,
}
}
}
|
|