Print Stars - 5
Time limit1sMemory limit128 MB
Print a centered pyramid of stars with N lines, where line i has 2i-1 stars padded with spaces.
- Level
Easy1 of 10
- Topics
- Implementation, Simulation
- Solved
- No attempts yet
Problem
Given an integer N, print a centered star triangle with N lines.
The first line must contain 1 star, the second line 3 stars, and so on. The N-th line must contain 2×N-1 stars. The stars on each line must be symmetric around the center of the whole triangle.
Input
The first line contains N. (1 ≤ N ≤ 100)
Output
Print the star triangle from the first line through the N-th line, in order.