Syntax
#include <math.h> double sqrt(double x);Description
sqrt calculates the nonnegative value of the square root of x.
sqrt returns the square root result. If x is negative, the function sets errno to EDOM, and returns 0.
This example computes the square root of 45.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(int argc,char **argv)
{
double value = 45.0;
printf("sqrt( %f ) = %f\n", value, sqrt(value));
return 0;
/****************************************************************************
The output should be:
sqrt( 45.000000 ) = 6.708204
****************************************************************************/
}
Related Information