我試圖使輸出是這樣的:反平行四邊形
我知道問題出在第三圈,但我不知道怎樣做才能彌補這方面的工作空間。
import java.util.Scanner;
public class Tester {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int x, y;
System.out.print("Enter the number of rows: ");
x = in.nextInt();
System.out.print("Enter the number of stars: ");
y = in.nextInt();
//loop for x lines
for(int i = 0; i < x; i++){
//loop for y stars
for(int j = 0; j < y; j++){
System.out.print("* ");
}
System.out.println();
for(int l = 0; l <= i; l--){
System.out.print(" ");
}
}
}
}
輸出什麼,你現在得到些什麼? –
我目前收到這個http://prntscr.com/8zjv4s – Roland