Home>Article>Backend Development> How to express power in C language

How to express power in C language

coldplay.xixi
coldplay.xixi Original
2020-09-02 09:14:06 113116browse

Method to express power in C language: first add the [math.h] header file; then define two floating-point variables and assign values; then use the Pow function to directly find the power of a number; finally use Printf The function prints the operation result to the screen.

How to express power in C language

【Related learning recommendation:C language tutorial video

represents Method of raising the power of a number in C language:

1. We use C language to find the power of a number. We need to use the pow function. To call this function, we need to add the math.h header first. document.

How to express power in C language

#2. We then define and assign two floating-point variables as base and exponent respectively, and then define a variable to store the calculation result.

How to express power in C language

3. Then we can use the Pow function to directly find the power of the number. We can know that the function has two parameters. The first parameter is the base, and the second parameter is the base. Each parameter is an exponent. Put the represented variables into the function respectively,

How to express power in C language

4. Finally, we can use the Printf function to print the operation results to the screen to see if the results are Normally, after debugging and running, the specified number is raised to the power in C language.

How to express power in C language

Related learning recommendations:php programming(video)

The above is the detailed content of How to express power 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