Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C language power operation
C language power operation
The power operation of C language can use the library function pow.

Power function prototype: double power (double x, double y);

Header file: math.h/cmath (in C++)

Function: calculate the y power of x.

Reference code:

# Contains? & ltstdio.h & gt

# Contains? & ltmath.h & gt

int? Master ()

{

int? a=3,b = 2;

Double? t? =? pow(a,b); //Calculate the square of 3 and output it?

printf("%.0lf\n ",t);

Return? 0; ?

}

/*

Output:

nine

*/