How to calculate fractional power using C#?

CsharpProgrammingServer Side Programming

To calculate fractional power in C#, use the Math.Pow method.

The following sets 5 to the power 3.7 −

double res = Math.Pow(5, 3.7);

The following is the complete example showing how to calculate fractional power in C# −

Example

 Live Demo

using System;
class Program {
   static void Main() {
      double res = Math.Pow(5, 3.7);

      Console.WriteLine("Result = {0}", res);
      Console.ReadLine();
   }
}

Output

Result = 385.646164200006
raja
Published on 09-Aug-2018 08:32:26
Advertisements