title: Drawing hourglass with user input for symbol and size
body: <p>I have been working on a self study task and i can't seem to get this right, if i try to print an hourglass using the code below. Still learning.</p>
  
  <pre><code>public class test
  {
      public static void hourglass(int size, char symbol){
  
          for(int i=size-1;i&gt;=1;i--){
  
            for(int j=i;j&lt;size;j++)
  
                System.out.print(" ");
  
            for(int j=1;j&lt;=i*2-1;j++)
  
                System.out.print(symbol);
  
                System.out.println();
          }
  
          for(int i=2;i&lt;=size-1;i++)
          {
  
           for(int j=i;j&lt;size;j++)
               System.out.print(" ");
  
           for(int j=1;j&lt;=i*2-1;j++)
  
               System.out.print(symbol);
               System.out.println();
  
          } 
  
      }
  }
  </code></pre>
  
  <p>it will print 3 perfectly:<br></p>
  
  <p><img src="https://i.stack.imgur.com/n9VAP.png" alt="output for 3"></p>
  
  <p>if i try to print it with numbers 5 and 7<br><br>
  <strong>5:</strong> <br><br>
  <img src="https://i.stack.imgur.com/s25hv.png" alt="output for 5"></p>
  
  <p>and then <strong>7:</strong> <br><br>
  <img src="https://i.stack.imgur.com/e7UaE.png" alt="output for 7"></p>
  
  <p>How would i go about correcting this?</p>