How to perform Multiplication of Exponents of same base using C#?



Firstly, set the base.

double n = 2;

Now set the two exponents for division.

double e1 = 5;
double e2 = 4;

Let us see the complete code to get the result of multiplication of exponents of the same base.

Example

 Live Demo

using System;

class Demo {
   static void Main() {

      double res, n, e1, e2;
      n = 2;
      e1 = 5;
      e2 = 4;
      res = e1 + e2;

      Console.WriteLine("Result = {0}^{1} : {2}", n, res, Math.Pow(n, res));
      Console.ReadLine();
   }
}

Output

Result = 2^9 : 512

Advertisements