거듭제곱 지수 값을 계산하려면 Math.pow() 메서드를 사용하십시오.
여기서 n은 숫자이고 p는 거듭제곱입니다. -
double res = Math.Pow(n, p);
다음은 완전한 코드입니다 -
예시
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();
}
} 출력
Exponent Power= 7 Result= 343