zoukankan      html  css  js  c++  java
  • 打印沙漏

    public class sdf {
        public static void main(String[] args) {
            int n = 7;
            int i,j,k,m,p;
            k = n/2+1;
            for (i = 0; i <= n; i++) {
                m = k - Math.abs(i-k);
                 p = Math.abs(2*(k-i))-1;
                if(p == -1){
                    continue;
                }
                for(j = 0 ; j < m; j ++){
                    System.out.print(" ");
                }
                for(j = 0; j < p; j++){
                    System.out.print("*");
                }
                System.out.println();
            }
        }
    }

  • 相关阅读:
    java List 学习
    java Map 的学习
    samba服务
    linux常用命令
    解决粘包问题
    Python网络编程
    python异常处理
    python中封装
    python中继承和多态
    python面向对象基础
  • 原文地址:https://www.cnblogs.com/superws/p/5256673.html
Copyright © 2011-2022 走看看