C/Math/Square Root
Calculate square root: how to use sqrt
#include <stdio.h>
#include <math.h>
int main ()
{
double param, result;
param = 1024.0;
result = sqrt (param);
printf ("sqrt(%lf) = %lf\n", param, result );
return 0;
}
Get the square root
#include <stdio.h>
#include <math.h> /* needed by sqrt() */
int main(void)
{
double answer;
answer = sqrt(20.0);
printf("%f", answer);
return 0;
}