1 import java.util.Scanner; 2 public class Jiujiuchengfabiao { 3 public static void main(String[] args) { 4 System.out.println("请输入一个数:"); 5 Scanner scanner=new Scanner(System.in); 6 int n=scanner.nextInt(); 7 scanner.close(); 8 jiuJiuPrint(n); 9 } 10 11 //打印九九乘法表的函数 12 public static void jiuJiuPrint(int n){ 13 for (int i = 1; i <=n; i++) { 14 for (int j = 1; j <=i ; j++) { 15 System.out.print(j+"*"+i+"="+j*i+' '); 16 } 17 System.out.println(); 18 } 19 } 20 } 21 /*运行结果 22 请输入一个数: 23 7 24 1*1=1 25 1*2=2 2*2=4 26 1*3=3 2*3=6 3*3=9 27 1*4=4 2*4=8 3*4=12 4*4=16 28 1*5=5 2*5=10 3*5=15 4*5=20 5*5=25 29 1*6=6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36 30 1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49 31 */