Pyramid Pattern Generator


Submit solution

Points: 10 (partial)
Time limit: 1.0s
Memory limit: 64M

Authors:
Problem type

題目說明

輸入一個正整數 n,代表金字塔的層數。程式需輸出對應高度的金字塔圖案。

輸入

一個大於0的正整數 n

輸出

輸出一個由 * 組成的金字塔,每層的星號數量為奇數,且逐層遞增。每層的星號需適當對齊,形成金字塔形狀。

範例輸入 #1

3

範例輸出 #1

  *
 ***
*****

範例輸入 #2

5

範例輸出 #2

    *
   ***
  *****
 *******
*********

Comments

There are no comments at the moment.