Log functions in C#

CsharpProgrammingServer Side Programming

With C#, you can easily work with Logarithms. It has the following methods for Log as well as Log base 10.

Sr.NoMethod & Description
1Log(Double)
Returns the natural (base e) logarithm of a specified number.
2LogDouble)(Double,
Returns the logarithm of a specified number in a specified base.
3Log10(Double)
Returns the base 10 logarithm of a specified number.

Let us see an example to work with Log functions in C# −

Example

using System;

class Demo {
   static void Main() {
      double val1 = Math.Log(1);
      Console.WriteLine(val1);

      double val2 = Math.Log10(1000);
      Console.WriteLine(val2);

   }
}
raja
Updated on 21-Jun-2020 12:31:31

Advertisements