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 #include
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!