C语言学习:开平方

C语言中,开平方需要用到 sqrt() ,并且需要 用到 math.h 头文件
例:

#include <stdio.h>
#include <math.h>
main()
{
float a,x;
printf("请输入一个正数:
");//这里按数据输入合法考虑,不考虑异常
scanf("%f",&a);//输入a的值
x=sqrt(a);//计算求x
printf("%f
",x));//输出x
}
原文地址:https://www.cnblogs.com/MountDa/p/13174772.html