描述:Java编程实现如下金字塔效果。
代码:
1 package tes;
2
3 public class cj {
4 public static void main(String[] args) {
5 for (int i = 1; i <=5; i++) {
6 for (int j = 5; j >i; j--) {
7 System.out.print(" ");
8 }
9 for (int j = i; j >=1; j--) {
10 System.out.print(j);
11 }
12 for (int j = 2; j <=i; j++) {
13 System.out.print(j);
14 }
15 System.out.println();
16 }
17 }
18 }