using System;
namespace RecursionTest
{
///
/// Summary description for Class1.
///
class Class1
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args)
{
Console.WriteLine("Input a double value: ");
double x = double.Parse(Console.ReadLine());
Console.WriteLine("Input an integer: ");
int n = int.Parse(Console.ReadLine());
Console.WriteLine("Power is {0:F6}", power(x,n));
Console.WriteLine("Power using math library is {0:F6}", Math.Pow(x,n));
}
static public double power(double x, int n)
{
if(n==0)
return 1;
else
return x * power(x, n-1);
}
}
}