Home > Java > javaTutorial > body text

How to express power of java

coldplay.xixi
Release: 2020-09-02 14:37:10
Original
44086 people have browsed it

How to express the power of java: First check the API of Math mathematical function; then define an a variable of 5 and a b variable of 3; then use [double c=Math.pow( a, b)】The code finds a raised to the power b; finally run the project.

How to express power of java

[Related recommendations: Programming Video Course]

How to express the power of java:

The first step is to check the API of Math mathematical function, you can seepow()The method returns the power of the second parameter of the first parameter in the format of Math.pow(m,n), which represents the nth power of m, as shown in the following figure:

How to express power of java

The second step, we can look at it through an example, define an a variable with a value of 5 and a b variable with a value of 3, use double c=Math.pow(a, b) The code finds a raised to the power b, as shown in the figure below:

How to express power of java

# Step 3: Run the project. You can see on the console that the result of a raised to the power b is 125. , as shown in the figure below:

How to express power of java

The fourth step, we can also use a for loop to express the nth power of a number, the code is as shown in the figure below:

How to express power of java

The fifth step is to run the project. You can see the same result in the console, as shown in the figure below:

How to express power of java

Step 6. Finally, we can learn Math mathematical functions. We can find sine, cosine, tangent, inverse tangent values, etc., as shown in the figure below:

How to express power of java

##Related Recommended:

Programming Video Course

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