title: Trying to Calculate logarithm base 10 without Math.h (Really close) Just having problems with connecting functions
body: <p>I'm trying to learn how to calculate the logarithm base 10 of any numbers that I enter via scanf to my code. I figure that I could calculate the ln(a) a being the number input. I have a working code that calculates this; however now i just want to divide any numbers that my ln(a) code outputs by the defined LN10. This is because the natural log of a number divided by the natural log of 10 will output my required log base 10 value that I am working to achieve. Here is the mess I have at the moment. Any help is extremely appreciated! </p>
  
  <pre><code>#define _CRT_SECURE_NO_WARNINGS
  #define ALMOSTZERO 0.0000000000000000001
  #define LN10 2.3025850929940456840179914546844
  
  #include &lt;stdio.h&gt;
  
  double log10(double);
  double ln(double);
  
  void main()
  {
      {
      double x, a;
      printf("Enter value: ");
      scanf("%lf", &amp;x);
      while (x &gt; 0)
      {
          double log10 = ln(x) * LN10;
          printf("log10(%lf)=%lf\n", x, a);
          printf("Enter value:  ");
          scanf("%lf", &amp;x);
      }
      }
  }
  
  double ln(double x)
  {
      double sum = 0.0;
      double xmlxpl = (x - 1) / (x + 1);
      double denom = 1.0;
      double frac = xmlxpl;
      double term = frac / denom;
  
      while (term &gt; ALMOSTZERO)
      {
          sum += term;
          //generate next term
          denom += 2.0;
          frac = frac * xmlxpl * xmlxpl;
          term = frac / denom;
      }
      return 2.0 * sum;
  }
  </code></pre>