Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How to calculate the power exponent value using C#?
To calculate the power exponent value, use the Math.pow() method.
Here, n is the number and p is the power −
double res = Math.Pow(n, p);
The following is the complete code −
Example
using System;
class Program {
static void Main() {
double n, p;
n = 7;
p = 3;
Console.WriteLine("Exponent Power= "+n);
double res = Math.Pow(n, p);
Console.WriteLine("Result= {0}", res);
Console.ReadLine();
}
}
Output
Exponent Power= 7 Result= 343
Advertisements
