我将如何使用嵌套for循环来使用java由星号生成实心矩形?
import java.util.Scanner;
public class Box {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int length;
int width;
int rectangle;
// input and output here
System.out.print("Input the width of the box: ");
width = keyboard.nextInt();
System.out.print("Input the length of the box: ");
length = keyboard.nextInt();
// use nested for loops here
}
}
这正是我的程序的基础,我需要一个程序,打印出一个实心矩形的星号使用嵌套循环
# 1 楼答案
这应该可以奏效,下次一定要让我们知道你已经尝试了什么。:)
# 2 楼答案