Home > Article > Backend Development > How to write x raised to the yth power in c program
Calculating the nth power of x in C language can be implemented using the library function pow. Function prototype: double pow(double x, double n).
The specific code is as follows:
#include <stdio.h> #include <math.h> int main( ) { printf("%f",pow(x,n)); return 0; }
Note: When using the pow function, the header file #include15dfdae10d7c0c52b8c9b87fff3f31d0 needs to be included in the source file.
Recommended learning: c language video tutorial
The above is the detailed content of How to write x raised to the yth power in c program. For more information, please follow other related articles on the PHP Chinese website!