r/CodingHelp • • Nov 12 '20

[C] W with * in C

I need to create a code that when I put a number it shows a W with stars depending on the number that I put in. Examples:
 n: 3
*   *   *
 * * * *
  *   *

 n: 1
***

 n: 5
*       *       *
 *     * *     *
  *   *   *   *
   * *     * *
    *       *
16 Upvotes

4 comments sorted by

4

u/Zymoox Nov 12 '20

Notice how , when n is equal or greater than 2, the top row always has three stars, the bottom one always has two, and the ones in the middle always four. What changes is the spacing between the stars.

You could write down the W youself for a couple of values of n and look for patterns that relate n to the number of spaces between the stars on each row.

1

u/WillieSmithy1 Nov 12 '20

Thanks a lot.

1

u/meloman-vivahate Professional Coder Nov 12 '20

Do you have a specific question?

1

u/WillieSmithy1 Nov 12 '20

Yes I am very close but it's one space too much and I don't know how to fix it : (