C语言中的幂函数··怎么写~老师没教过·
来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:综合作业 时间:2024/07/28 14:56:35
C语言中的幂函数··
怎么写~老师没教过·
怎么写~老师没教过·
![C语言中的幂函数··怎么写~老师没教过·](/uploads/image/z/1916371-19-1.jpg?t=C%E8%AF%AD%E8%A8%80%E4%B8%AD%E7%9A%84%E5%B9%82%E5%87%BD%E6%95%B0%C2%B7%C2%B7%E6%80%8E%E4%B9%88%E5%86%99%7E%E8%80%81%E5%B8%88%E6%B2%A1%E6%95%99%E8%BF%87%C2%B7)
原型:extern float pow(float x, float y);
用法:#include <math.h>
功能:计算x的y次幂.
说明:x应大于零,返回幂指数的结果.
举例:
// pow.c
#include <stdlib.h>
#include <math.h>
#include <conio.h>
void main()
{
printf("4^5=%f",pow(4.,5.));
getchar();
}
相关函数:pow10
用法:#include <math.h>
功能:计算x的y次幂.
说明:x应大于零,返回幂指数的结果.
举例:
// pow.c
#include <stdlib.h>
#include <math.h>
#include <conio.h>
void main()
{
printf("4^5=%f",pow(4.,5.));
getchar();
}
相关函数:pow10