您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

C语言pow函数

2018/12/8 2:41:10发布111次查看
原型:extern float pow(float x, float y);
用法:#include
功能:计算x的y次幂。
说明:x应大于零,返回幂指数的结果。
举例:
// pow.c
#include
#include
main()
{
clrscr(); // clear screen
textmode(0x00); // 6 lines per lcd screen
printf(4^5=%f,pow(4.,5.));
getchar();
return 0;
}
1,要加入头文件 math.h
2,pow(x,y);//其作用是计算x的y次方。x、y及函数值都是double型
例:
我要计算2的5次方
源代码如下:
#includestdio.h
#includemath.h
main()
{
long total;
int x = 2, y = 5;
total = pow(x,y); /*调用pow函数*/
printf(%ld,total);
getch();
}
原型:extern float pow(float x, float y);
用法:#include
功能:计算x的y次幂。
说明:x应大于零,返回幂指数的结果。
举例:
// pow.c
#include
#include
main()
{
clrscr(); // clear screen
textmode(0x00); // 6 lines per lcd screen
printf(4^5=%f,pow(4.,5.));
getchar();
return 0;
}
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product