c语言sqrt函数的用法
sqrt函数用于计算一个非负实数的平方根。
sqrt的函数原型: 在VC6.0中的math.h头文件的函数原型为double sqrt(double);
说明:sqrt即Square Root Calculations(平方根计算),通过这种运算可以考验CPU的浮点能力。
头文件:math.h
程序示例:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#include <math.h>
#include <stdio.h>
int main( void )
{
double x = 4.0, result;
result = sqrt (x); //result*result = x
printf ( "The square root of % is %\n" , x, result);
return 0;
}
|
以上就是本次介绍的全部相关内容,大家如果有需要补充的可以联系服务器之家小编。
原文链接:https://blog.csdn.net/ma451152002/article/details/8100517