c语言中如何开根号运算
来源:百度知道 编辑:UC知道 时间:2024/05/17 04:11:39
在keil编译器中用C语言编求一个数的平方根
用math.h里封装好的函数,具体如下:
求平方根:double sqrt(double x)
例:
#include <math.h>
#include <stdio.h>
int main(void)
{
double x = 4.0, result;
result = sqrt(x);
printf("The square root of %lf is %lf
", x, result);
return 0;
}
扩展资料:
关于c语言的基本运算
1.加法运算符 +
int a = 10;
int b = a + 5;
在第3行利用加法运算符 + 进行了加法运算,再将和赋值给了变量b,最终变量b的值是15