大家好,又見面了,我是你們的朋友全棧君。
#include<stdio.h>
#include<math.h>
//power函數
double power(double x,double y);
int main()
{
double x = 2.0, y = 3.0, z;
z = power(x, y);
printf(“%f\n”,z);
while (1);
return 0;
}
double power(double x, double y)
{
double z = 1.0;
while (y)
{
z =z*x;
–y;
}
return z;
}
結果:
釋出者:全棧程式員棧長,轉載請注明出處:https://javaforall.cn/167148.html原文連結:https://javaforall.cn