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);   //长双精度开方

你可能感兴趣的:(c/c++)