解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int m = scanner.nextInt();
for(int i=n-1;i>=0;i--) {
for(int j=1;j<=m;j++)
System.out.print(" ");
for(int j=1;j<=i;j++)
System.out.print(" ");
for(int k=1;k<=(n-i)*2-1;k++)
System.out.print("*");
for(int j=1;j<=m;j++)
System.out.print(" ");
for(int k=1;k<=2*i+1;k++)
System.out.print("*");
System.out.println();
}
}
}
0.0分
0 人评分