title: How to count the digits in a number, including leading zeros?
body: <p>This code tries to count digits in the input number.</p>
  
  <p>If the input number is <code>06584</code>, the output of this code will be <code>4</code>, excluding zero. How can I get <code>5</code> as output (so counting the zero)?</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  void main()
  {
      int n,c=0,d;
      printf("Enter no\n");
      scanf("%d",&amp;n);
      while(n!=0)
      {
          d=n%10;
          c++;
          n=n/10;
      }
      printf("No of digits=&gt;%d\n",c);
  }
  </code></pre>