Home>Article>Backend Development> What is the code to open the root number in C language?
In C language, the code to open the root sign is "sqrt (floating point value x)"; for example, "sqrt(4.0)" performs the square root operation on 4, and the result is 2. sqrt() is a built-in root operation function in C language. Its operation result is the arithmetic square root of the function variable; this function can neither operate negative values nor output imaginary results.
The operating environment of this tutorial: Windows 7 system, C 17 version, Dell G3 computer.
Add #include
Then use sqrt, you can use double definition
For example:
#include#include #include double sqrt(double n); int main(void) { double x = 3.1415926540, result; result = sqrt(x); printf("The square root of %lf is %lf", x, result); return 0; }
Recommended tutorial: "C#"
The above is the detailed content of What is the code to open the root number in C language?. For more information, please follow other related articles on the PHP Chinese website!