Home >>C Math Functions >C math sqrt() function
The C math sqrt() function is used to return the square root of the given argument x. It takes a single argument (in double) and returns the square root (also in double). This function is defined in math.h header file.
Syntax:double sqrt(double x)
xIt is the floating point value.
Here is an example of sqrt() function:
#include <stdio.h>
#include <math.h>
int main ()
{
printf("Square root of %lf is %lf\n", 4.0, sqrt(4.0) );
return(0);
}
#include <stdio.h>
#include <math.h>
int main ()
{
printf("Square root of %lf is %lf\n", 64.0, sqrt(64.0) );
return(0);
}