Home > Article > Backend Development > Usage of sqrt function in C language
Usage of sqrt function in c language
The sqrt function is used to calculate the square root of a non-negative real number. The function prototype of
sqrt: The function prototype of the math.h header file in VC6.0 is double sqrt(double);
Note: sqrt is Square Root Calculations. This operation can test the floating point capability of the CPU.
Header file: math.h
Program example:
#include <math.h> #include <stdio.h> int main(void) { double x = 4.0, result; result = sqrt(x); //result*result = x printf("The square root of % is %\n", x, result); return 0; }
Recommended learning:c language video tutorial
The above is the detailed content of Usage of sqrt function in C language. For more information, please follow other related articles on the PHP Chinese website!