What is the square function in C language?

angryTom
Release: 2020-03-09 15:07:00
Original
39418 people have browsed it

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);
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!