码迷,mamicode.com
首页 > 其他好文 > 详细

power函数

时间:2017-11-13 23:14:11      阅读:268      评论:0      收藏:0      [点我收藏+]

标签:double   es2017   img   stdio.h   math.h   clu   技术   src   images   

#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;
}

结果:

技术分享

 

power函数

标签:double   es2017   img   stdio.h   math.h   clu   技术   src   images   

原文地址:http://www.cnblogs.com/panyani-532355476/p/7828374.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!