Computer >> Computer tutorials >  >> Programming >> C#

How to perform Division of Exponents of Same Base using C#?


Firstly, set the base −

double n = 10;

Now set the two exponents for division −

double e1 = 10;
double e2 = 8;

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

Example

using System;

class Demo {
   static void Main() {
      double res, n, e1, e2;

      n = 10;
      e1 = 10;
      e2 = 8;

      res = e1 - e2;

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

output

Result = 10^2 : 100