java编程用循环语句,输出下图形 # ### ##### ####### ####### ##### ### # 5
展开全部
int num = 10;
for (int i = 1; i < num; i++) { for (int j = num; j > i; j--) { System.out.print(" "); } for (int j = 0; j < i; j++) { System.out.print("*"); } for (int j = 1; j < i; j++) { System.out.print("*"); } for (int j = num; j > i; j--) { System.out.print(" "); } System.out.println(); }for (int i = 2; i < num; i++) { for (int j = 0; j <i; j++) { System.out.print(" "); } for (int j = i; j <num; j++) { System.out.print("*"); } for (int j = i+1; j <num; j++) { System.out.print("*"); } for (int j = 0; j<i; j++) { System.out.print(" "); } System.out.println(); }
for (int i = 1; i < num; i++) { for (int j = num; j > i; j--) { System.out.print(" "); } for (int j = 0; j < i; j++) { System.out.print("*"); } for (int j = 1; j < i; j++) { System.out.print("*"); } for (int j = num; j > i; j--) { System.out.print(" "); } System.out.println(); }for (int i = 2; i < num; i++) { for (int j = 0; j <i; j++) { System.out.print(" "); } for (int j = i; j <num; j++) { System.out.print("*"); } for (int j = i+1; j <num; j++) { System.out.print("*"); } for (int j = 0; j<i; j++) { System.out.print(" "); } System.out.println(); }
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询