输出楼梯树

 1 Static void OutPutStaircase(int n){
 2 //n为楼梯数
 3     for(int i = 1; i <= n; i++){
 4             for(int j = 1; j <= n-i; j++){
 5                 Console.Write(" ");
 6             }
 7             for(int k = 1; k <= i; k++){
 8                 Console.Write("#");
 9             }
10             Console.WriteLine("");
11         }
12 }
13 //--------输出如下:
14      #
15     ##
16    ###
17   ####
18  #####
19 ######

 

posted @ 2016-01-13 22:49  HoldonYou  阅读(150)  评论(0编辑  收藏  举报