The power of a number means how many times to use the number in multiplication. This can be easily calculated in C#.

Let’s look at a simple example now:

Before looking at the example, let’s look at the method’s signature:

1 2 3 |
double math.Pow(doublex,double y) |

The method raises *a* to the power of *b* and returns the result as *double*. In other words, *a* is multiplied by itself *b* times.

Let’s look at a simple example now:

1 2 3 4 5 6 7 8 |
static void Main(string[] args) { double result = Math.Pow(3, 4); //result= 3*3*3*3=81 Console.WriteLine(result.ToString()); Console.ReadKey(); } |

**Example 2:**

**Source Code:**

1 2 3 4 5 6 7 8 9 10 11 12 |
static void Main(string[] args) { Console.Write("Number 1 : "); int num1 = Convert.ToInt32(Console.ReadLine()); Console.Write("Number 2 : "); int num2 = Convert.ToInt32(Console.ReadLine()); double result = Math.Pow(num1, num2); Console.WriteLine(num1+"^"+num2+"= "+result.ToString()); Console.ReadKey(); } |

**Output:**