自己定义的pow(,)函数
#include <stdio.h>int main()
{
double power(double a, double b);
double x = 2,y = 3,z;
z = power(x,y);
printf("z = %10.8f\n",z);
}
double power(double a, double b)
{
double n = b;
double sum = 1;
do
{
sum = sum*a;
b--;
}while(b != 0);
return(sum);
}
页:
[1]