title: How to control the number of exponent digits after 'e' in C printf %e?
body: <p>I want to control the number of exponent digits after 'e' in C <code>printf %e</code>?</p>
  
  <p>For example, C <code>printf("%e")</code> result <code>2.35e+03</code>, but I want <code>2.35e+003</code>, I need 3 digits of exponent, how do I use <code>printf</code>?</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main()
  {
      double x=34523423.52342353;
      printf("%.3g\n%.3e",x,x);
      return 0;
  }
  </code></pre>
  
  <p><strong>Result:</strong>
  <a href="http://codepad.org/dSLzQIrn" rel="noreferrer">http://codepad.org/dSLzQIrn</a></p>
  
  <pre><code>3.45e+07
  3.452e+07
  </code></pre>
  
  <p>I want </p>
  
  <pre><code>3.45e+007
  3.452e+007
  </code></pre>
  
  <p>But interestingly, I got the right results in Windows with MinGW.</p>