- sqrt( ) function in C is used to find the square root of the given number.
- ”math.h” header file supports sqrt( ) function in C language. Syntax for sqrt( ) function in C is given below.
double sqrt (double x);
Example program for sqrt() function in C:
#include <stdio.h>
#include <math.h>
int main()
{
printf ("sqrt of 16 = %f\n", sqrt (16) );
printf ("sqrt of 2 = %f\n", sqrt (2) );
return 0;
}
Output:
| sqrt of 16 = 4.000000 sqrt of 2 = 1.414214 |






0 comments:
Post a Comment