永发信息网

c语言sqrt(5) 等于多少?

答案:5  悬赏:30  手机版
解决时间 2021-04-07 19:26
  • 提问者网友:火车头
  • 2021-04-07 06:44
c语言sqrt(5) 等于多少?
最佳答案
  • 五星知识达人网友:洎扰庸人
  • 2021-04-07 07:31
sqrt()函数是开平方根。
具体sqrt(5),等于什么得看把这个函数的返回值赋给什么类型的变量。
例如 int a; a=sqrt(5);
此时输出a,结果是2,因为a是整型
如果 double a ; a=sqrt(5) ;
此时输出a ,结果就是一个小数,二点多。
全部回答
  • 1楼网友:第幾種人
  • 2021-04-07 10:46
以下为C的平方根函数解释。
使用sqrt()需包含头文件
sqrt()的入参为double型,返回值为double型
我的编译器,sqrt(5)=2.236068

NAME sqrt, sqrtf, sqrtl - square root function
SYNOPSIS #include
double sqrt(double x);
float sqrtf(float x);
long double sqrtl(long double x);
Link with -lm.
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
sqrtf(), sqrtl(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE; or cc -std=c99
DESCRIPTION The sqrt() function returns the non-negative square root of x.
RETURN VALUE On success, these functions return the square root of x.
If x is a NaN, a NaN is returned.
If x is +0 (-0), +0 (-0) is returned.
If x is positive infinity, positive infinity is returned.
If x is less than -0, a domain error occurs, and a NaN is returned.
  • 2楼网友:低血压的长颈鹿
  • 2021-04-07 09:52
在VC6.0的编译器下,答案是2.23607
  • 3楼网友:零点过十分
  • 2021-04-07 09:09
在VC6.0中的math.h头文件的函数原型为double sqrt(double);
返回值为双精度的 在VC6.0的编译器下 为 2.236068
  • 4楼网友:轮獄道
  • 2021-04-07 08:41
就是根号5的意思啊!这个应该知道吧!
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯