Triangles
Time limit1sMemory limit128 MB
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 (). The last line of input contains . 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.