/*
打印一个a行,b列的长方形
*/
import java.util.Scanner;
class Print
{
public static void main(String[] args)
{
Scanner a=new Scanner(System.in);
System.out.print("请输入行数:");
int x=a.nextInt();
Scanner b=new Scanner(System.in);
System.out.print("请输入列数:");
int y=b.nextInt();
printChangFangXing(x,y);
}
public static void printChangFangXing(int row,int col){
for (int x=0;x<row ;x++ )
{
for (int y=0;y<col ;y++ )
{
System.out.print("$");
}
System.out.println();
}
return;
}
}
|
|