This page is still under construction.

Parts of this page are still being built. What you see may change.

Triangles

Time limit1sMemory limit128 MB

Summary
For each size n read from input until 0, print a right triangle of stars with n rows, row i having i stars.
Level

Easy1 of 10

Topics
Implementation, Simulation
Solved
No attempts yet

Problem

Drawing a triangle made of stars (*) of any given size is not hard. For example, a triangle of size 5 looks like this (5 stars tall and 5 stars wide):

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

Given several sizes, draw a triangle of each size.

Input

Each line of input contains a single positive integer nn (1≤n≤1001 \le n \le 100). The last line of input contains 00. For each non-zero integer, draw a triangle of that size.

Output

Output a triangle for each size, in order. Each triangle is wider toward the bottom. There are no blank lines between triangles.

Examples3

  1. Example 1

    Input
    5
    3
    2
    7
    0
    
    Expected output
    *
    **
    ***
    ****
    *****
    *
    **
    ***
    *
    **
    *
    **
    ***
    ****
    *****
    ******
    *******
    
  2. Example 2

    Input
    1
    0
    
    Expected output
    *
    
  3. Example 3

    Input
    2
    0
    
    Expected output
    *
    **