How to calculate fractional power using C#?


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

Updated on: 20-Jun-2020

379 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements