#C9455. Isosceles Triangle Drawing
Isosceles Triangle Drawing
Isosceles Triangle Drawing
Given an odd integer n, your task is to draw an isosceles triangle on an n x n grid. The triangle should be drawn using the *
character, and the rest of the grid should be filled with spaces. The triangle's base will have exactly n
asterisks and it must be centered in the grid.
The conditions on n are as follows:
- n must be odd
- 1 \(\le n \le\) 99
If the input does not satisfy these conditions, output the error message: "n must be an odd integer between 1 and 99."
Example
Input: 5Output: *
inputFormat
The input consists of a single integer n read from standard input (stdin). It is guaranteed that for valid cases, 1 \(\le n \le\) 99 and n is odd.
outputFormat
Print the isosceles triangle on standard output (stdout), with each row on a new line. If the input is invalid (i.e., n is even, less than 1, or greater than 99), print the error message exactly as follows: n must be an odd integer between 1 and 99.
1
*
</p>