C语言sqrt函数的实例用法讲解

Lana ·
更新时间:2024-09-21
· 534 次阅读

c语言sqrt函数的用法

sqrt函数用于计算一个非负实数的平方根。

sqrt的函数原型: 在VC6.0中的math.h头文件的函数原型为double sqrt(double);

说明:sqrt即Square Root Calculations(平方根计算),通过这种运算可以考验CPU的浮点能力。

头文件:math.h

程序示例:

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

以上就是本次介绍的全部相关内容,大家如果有需要补充的可以联系软件开发网小编。



sqrt

需要 登录 后方可回复, 如果你还没有账号请 注册新账号