#K15796. Left-Aligned Right-Angled Triangle
Left-Aligned Right-Angled Triangle
Left-Aligned Right-Angled Triangle
Given a positive integer n
(which may be 0), print a left-aligned right-angled triangle of height n
using the '*' character. Each row i (where \(1 \le i \le n\)) of the triangle should contain exactly \(i\) '*' characters.
For example, if n = 3
, the output should be:
* ** ***
If n = 0
, no characters should be printed.
inputFormat
The input consists of a single integer n
which represents the height of the triangle. The input is read from standard input.
outputFormat
The output should print a left-aligned triangle with n
lines. The ith line should contain i
'*' characters followed by a newline. If n
is 0, nothing should be printed.
1
*
</p>