C examples for math.h:sqrt
function
<cmath> <ctgmath> <math.h>
Compute square root
long double sqrtl (long double x); long double sqrt (long double x); float sqrtf (float x); double sqrt (double x); float sqrt (float x); double sqrt (T x);
Parameter | Description |
---|---|
x | Value whose square root is computed. If the argument is negative, a domain error occurs. |
Square root of x.
#include <stdio.h> #include <math.h> int main ()/*from w w w . java2 s. co m*/ { double param = 1024.0; double result = sqrt (param); printf ("sqrt(%f) = %f\n", param, result ); return 0; }