Blog for Learning

This blog contains lesson material, material summary, questions and answers, definitions, types and examples, and others.

Advertisement

Powered by Blogger.

Visitors

Flag Counter

Pages

Java learning: How to Calculate Rank Operations


In the case of yesterday's circular area program , we use the power of two to calculate the area of ​​a circle. The power of two can be written by multiplying a variable or number to be raised by two. For example, it can be written But how about a lot of rank? for example There's no way we would multiply that much in the code. Therefore, we need a rank function to calculate it. Java already provides a rank function that can be used at any time. This function has two parameters, namely the number to be raised and the rank.r2r*r4112

Math.pow (number, rank);
Example program, please create a new class named Rank in the meeting package3 . Then follow the following code: The program code above will produce an output: 32, because 2 5will produce 32.



Sumber: https://www.petanikode.com/java-pangkat/
0 Komentar untuk "Java learning: How to Calculate Rank Operations"

Silahkan berkomentar sesuai artikel

 
Template By Kunci Dunia
Back To Top