@Test
//输出n行n列的星星
public void star(){
//link表示行
//row表示列
System.out.println("请输入行和列:");
Scanner input = new Scanner(System.in);
int link=input.nextInt();
int row=input.nextInt();
for(int k=1;k <= link;k++) {
for (int l=1; l <= row; l++) {
System.out.print("*");
}
//打印换行
System.out.println();
}
input.close();
}
打印输出n行n列的*
最新推荐文章于 2022-03-20 19:46:10 发布