大家好,又见面了,我是你们的朋友全栈君。
#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