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

CsharpProgrammingServer Side Programming

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

 Live Demo

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
raja
Updated on 22-Jun-2020 08:23:13

Advertisements