sqrt - C math.h

C examples for math.h:sqrt

Type

function

From

<cmath>
<ctgmath>
<math.h>

Description

Compute square root

Prototype

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);           

Parameters

Parameter Description
x Value whose square root is computed. If the argument is negative, a domain error occurs.

Return Value

Square root of x.

Demo Code


#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;
}

Related Tutorials