title: Counting the number of digits before and after the decimal point in C
body: <p>I need to write a C program that will compare the number of digits before decimal point and after the decimal point and make sure they are equal.  </p>
  
  <p>How can I count how many powers of ten we have before and after the decimal point?</p>
  
  <p>Here is what I have so far: </p>
  
  <pre><code>void main()
  {
      is_equal(6757.658);   
  }
  
  INT is_equal(double x)
  {
     int digits = 0;
     while (x) {
       x /= 10;
       digits++;
     }
  
     printf("%d ",digits);
  }
  </code></pre>
  
  <p>Is there a better way to do this?</p>