Print Fixed Star Pattern

TCS NQT Coding Easy Go Ad-Free - ₹20/mo

Write a program to print a symmetric star pattern with exactly 10 rows as specified. The pattern has stars and leading spaces arranged such that the number of stars per row from top to bottom is: 1, 3, 5, 7, 9, 9, 7, 5, 3, 1. The corresponding leading spaces for each row are: 8, 7, 6, 5, 4, 4, 5, 6, 7, 8. The output must match the pattern exactly without any additional characters or deviations.

Examples:

Input: None

Output:

        *
       ***
      *****
     *******
    *********
    *********
     *******
      *****
       ***
        *

Input: None

Output:

        *
       ***
      *****
     *******
    *********
    *********
     *******
      *****
       ***
        *

Input: None

Output:

        *
       ***
      *****
     *******
    *********
    *********
     *******
      *****
       ***
        *

Constraints

  • The pattern must have exactly 10 rows.
  • Each row consists of leading spaces followed by stars, with no trailing spaces required.
  • The output must match the given pattern exactly, including spaces and star counts.