- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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