title: Problems writing code to draw a rhombus
body: <p>So i have assignment to type a code which will ask me for a "w". After i type in a number it will create a rhombus with a diagonal which is 2w. The rhombus must be made of intervals and * . The problem that i face now is that when i type w=5 the diagonal is 5 instead of 10 ....</p>
  
  <pre><code>main()
  {
  int w;
  int i;
  int j;
  
  printf("w: ");
  scanf("%d", &amp;w);
  printf("");
  
  i = 0;
  while (w &gt;= i)
  {
      for (j = 0; j &lt; (w - i); j++)
          printf(" ");
      for (j = 0; j &lt; i + 1; j++) {
          printf("*");
          if (j &lt;= i) {
              printf(" ");
          }
      }
      printf("\n");
      i = i + 1;
  }
  i = w - 1;
  while (i &gt;= 0)
  {
      for (j = 0; j &lt; (w - i); j++)
          printf(" ");
      for (j = 0; j &lt; i + 1; j++) {
          printf("*");
          if (j &lt;= i) {
              printf(" ");
          }
      }
      printf("\n");
      i = i - 1;
  }
  return 0;
  }
  </code></pre>