Home  >  Article  >  Backend Development  >  What is the square function in C language?

What is the square function in C language?

angryTom
angryTomOriginal
2020-03-09 15:07:0039435browse

What is the square function in C language?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn