C語言sqrt函數(shù)的實例用法講解
更新時間:2020年02月06日 14:42:28 作者:ma451152002
在本篇文章里小編給大家整理的是關于C語言sqrt函數(shù)的實例內(nèi)容以及用法詳解,需要的朋友們可以參考下。
c語言sqrt函數(shù)的用法
sqrt函數(shù)用于計算一個非負實數(shù)的平方根。
sqrt的函數(shù)原型: 在VC6.0中的math.h頭文件的函數(shù)原型為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;
}
以上就是本次介紹的全部相關內(nèi)容,大家如果有需要補充的可以聯(lián)系腳本之家小編。

