What is the square function in C language
In C language, there is no special function to find the square. For the variable x, its square It can be expressed as x*x, that is, just multiply two numbers (or variables) directly.
Recommended learning: C language video tutorial
In addition, in C language, the math.h file contains a library function for exponentiation (including square root), which is pow( x,y).
Where x and y are both double precision floating point (double) types, x is the base, y is the exponent (if it is a decimal, it is the square root)
Usage example:
Find the square of 10
int res = pow(10, 2);
For more C languageIntroduction to programming tutorials, please pay attention to the PHP Chinese website!
The above is the detailed content of What is the square function in C language?. For more information, please follow other related articles on the PHP Chinese website!