title: How to extract digits from a number in C? Begining from the most significant digit?
body: <p>Getting digits from a number beginning from the least significant in C is pretty easy:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      int num = 1024;
  
      while(num != 0)
      {
          int digit = num % 10;
          num = num / 10;
          printf("%d\n", digit);
      }
  
  
      return 0;
  }
  </code></pre>
  
  <p>But how to extract digits beginning from the first digit (here 1), that the solution could be applied to any number?</p>
  
  <p>It would be trivial with arrays, but I don't want to use array, and I don't want to use logical operators.</p>