java 实例,打印菱形
2017-03-20 10:53 backyyan 阅读(267) 评论(0) 编辑 收藏 举报public class lingxing { public static void main(String[] args) { int i, j, k; for (i = 0; i < 5; i++) { for (j = 0; j < 5 - i; j++) System.out.print(" "); for (k = 0; k < 2 * i - 1; k++) System.out.print("*"); System.out.println(); } for (i = 3; i > 0; i--) { for (j = 0; j < 5 - i; j++) System.out.print(" "); for (k = 0; k < 2 * i - 1; k++) System.out.print("*"); System.out.println(); } } }