title: Draw a pattern using for loops in C
body: <p>Can you guys please help me out here?
  I have to print that <strong>kind</strong> of pattern <a href="https://i.stack.imgur.com/ZtNyB.png" rel="nofollow noreferrer">Example for pattern </a></p>
  
  <p>in that example the input for the size is 21.</p>
  
  <pre><code>for (int row = 0; row &lt; size; row++)
      for (int col = 0; col &lt; size; col++) {
          if (row == 0 &amp;&amp; col == 0 || row == 0 &amp;&amp; col == size - 1 || row == size - 1 &amp;&amp; col == 0 || row == size - 1 &amp;&amp; col == size - 1)
              printf("+");
          if ((row == 0 || row == size - 1) &amp;&amp; (col &gt; 0 &amp;&amp; col &lt; size - 1))
              printf("-");
          if ((row &gt; 0 &amp;&amp; row &lt; size - 1) &amp;&amp; (col == 0 || col == size - 1))
              printf("|");
          if ((row &gt; 0 &amp;&amp; row &lt; size - 1) &amp;&amp; (col &gt; 0 &amp;&amp; col &lt; size - 1)) {
              if (row == col)
                  printf("\\");
              else
              if (col == size - 2)
                  printf("/");
              else
              if (row == x &amp;&amp; col == x)
                  printf("X");
              else
                  printf(" ");
          }
      }
  </code></pre>
  
  <p>This is the code i wrote but it is not good .
  How can I fix it ?
  Thank you!</p>