Star Printing - 6
InterviewTime limit1sMemory limit128 MB
Print a centered triangle of stars whose width decreases by 2 each line from 2N-1 down to 1.
- Level
Easy2 of 10
- Topics
- Implementation, Simulation
- Solved
- No attempts yet
Problem
Given an integer N, print stars over N lines.
The first line contains 2×N-1 stars, the second line contains 2×N-3 stars, and each following line has 2 fewer stars. The N-th and final line contains 1 star.
Add spaces on the left of each line so that the stars are centered symmetrically.
Input
The first line contains an integer N. (1 ≤ N ≤ 100)
Output
Print the stars in order from the first line through the N-th line.