package wac.wev.LianXi;
//需求:键盘录入一个值(1<=n<=9)之间,输出nn乘法表
import java.util.Scanner;
public class FunctionDemo3 {
public static void main(String[] args){
//先键盘录入和导包
Scanner sc = new Scanner(System.in);
//接收数据
System.out.println("请输入一个数据(1~9):");
int n =sc.nextInt();
chengFaBiao(n);
}
//1:先明确返回值:void
//2:明确参数类型和参数个数:int
public static void chengFaBiao(int n){
for(int x=1;x<=n;x++){//限定行
for(int y=1;y<=x;y++){//限定列
System.out.print(x+""+y+"="+(xy)+"\t");//拼接输出格式
}
System.out.println();//换行
}
}
}
转载于:https://blog.51cto.com/13852519/2140328