Star Pattern
Pattern for N = 4

picture

The dots represent spaces.
Input Format:
The first line contains a single integer ‘T’ representing the number of test cases. 

The first line of each test case will contain an integer ‘N’ that is the total number of rows.
Output Format:
For each test case, print the pattern of N lines.

Output for every test case will be printed in a separate line.
Constraints :
1 <= T <= 100
1 <= N <= 100
CodingNinjas
author
2y

Tip 1 : A simple program of nested for loop. Display the star symbols at locations where row no. is equal to column no.

CodingNinjas
author
2y
Brute Force

The basic idea of this approach is to print the pattern row-wise. The pattern consists of ’N’ rows. Each row contains 2 * ‘N’ - 1 star. In addition to these stars, there are leading spaces....read more

Help your peers!
Add answer anonymously...
Wipro Sales Executive Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter