- static void DengYaoSanJiao(int x){
- int y = (x+1)/2;
- int count1 = (x+1)/2;
- int count2 = (x+1)/2;
- for(int i=0;i<y;i++){
- for(int j=1;j<=x;j++){
- if(i==y-1)
- System.out.print("*");
-
- else if((i!=y+1) && (j == count1 || j == count2))
- System.out.print("*");
-
- else
- System.out.print(" ");
- }
- count1++;
- count2--;
- System.out.println();
- }
- }
复制代码 |