发布网友 发布时间:2024-09-29 02:48
共1个回答
热心网友 时间:2024-10-31 02:51
# include <math.h>
double power(double x, int n)
{
int i = 1, index = 0 ;
double result = 0 ;
for(index = 1 ; index <= n ; index++)
{
result += i * pow(x, index) ;
i = -i ;
}
return (result) ;
}