c语言中怎么表示多次方? | 您所在的位置:网站首页 › 函数计算x的n次方C语言 › c语言中怎么表示多次方? |
c语言中表示乘方的函数为pow() 头文件:#include 函数原型:double pow(double x, double y); 函数说明:The pow() function returns the value of x raised to the power of y. pow()函数返回x的y次方值。 例: 1 2 3 4 5 6 7 8 9 #include #include void main() { double pw; int a=2 ; pw= pow (a,10); //a的10次方 printf ( "%d^10=%g\n" , a,pw ); }相关函数: float powf(float x, float y); //单精度乘方 long double powl(long double x, long double y); //长双精度乘方 double sqrt(double x); //双精度开方 float sqrtf(float x); //单精度开方 long double sqrtl(long double x); //长双精度开方 |
CopyRight 2018-2019 实验室设备网 版权所有 |