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