title: How to print 10 values per line in C where the values are in decreasing order and using only while loops and if-else-statements?
body: <p>I want to write a program where the user can input a number between <code>1</code> and <code>100</code>. The program will then display that number with all numbers preceding it until <code>1</code>. Each line should have 10 numbers only. So basically it should look like:</p>
  
  <hr>
  
  <p><a href="https://i.stack.imgur.com/lHYYh.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lHYYh.jpg" alt="enter image description here"></a></p>
  
  <hr>
  
  <p>I used this code:</p>
  
  <hr>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;conio.h&gt;
  
  void main(void) {
      int num, counter;
      counter = 1;
  
      printf("Input a number between 1 and 100: ");
      scanf("%d", &amp;num);
  
      printf("\n");
  
      if (num&gt; 1  &amp;&amp; num &lt; 100)
          while (num &gt; 0) {
              printf("%d %d %d %d %d %d %d %d %d %d \n", num, num - 1, num - 2, num - 3, num - 4, num - 5, num - 6, num - 7, num - 8, num - 9);
              num -= 10;
          }
      else
          printf("\nInvalid value. Please enter a different number.");
  
      getch();
  }
  </code></pre>
  
  <hr>
  
  <p>But at the end, it still keeps on showing <code>0</code> and negative numbers. </p>
  
  <p><a href="https://i.stack.imgur.com/zLskY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zLskY.png" alt="enter image description here"></a></p>
  
  <p>How do I fix this?</p>