# C# program to calculate the multiplication of two exponents of the same base

Here, we are going to learn how to calculate the multiplication of two exponents of the same base in C#?
Submitted by Nidhi, on October 03, 2020

Here, we will calculate the multiplication of two exponents of the same base, here we will read the values of the base and exponents then find the sum of exponents and then calculate multiplication using Pow() method of Math class.

Program:

The source code to calculate the multiplication of two exponents of the same base is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.

```//C# program to calculate the multiplication
//of two exponents of the same Base

using System;

class MathEx
{
static void Main()
{
double Base                 = 0.0;
double Exponent1            = 0.0;
double Exponent2            = 0.0;
double ExponentSum          = 0.0;
double ExpMultiplication    = 0.0;

Console.Write("Enter the value of base: ");

Console.Write("Enter the value of 1st exponent:");

Console.Write("Enter the value of 2nd exponent:");

ExponentSum = Exponent1 + Exponent2;

ExpMultiplication = Math.Pow(Base, ExponentSum);

Console.WriteLine("{0}^{1} : {2}", Base, ExponentSum, ExpMultiplication);
}
}
```

Output:

```Enter the value of base: 2
Enter the value of 1st exponent:3
Enter the value of 2nd exponent:2
2^5 : 32
Press any key to continue . . .
```

Explanation:

Here, we created a class MathEx that contains the Main() method. The Main() method is used as an entry point for the program. Here we read the values of variables Base, Exponent1, and Exponent2. Then we calculated the sum of exponents. After that, we calculated the result using the Pow() method of Math class and print the result on the console screen.