|
Operator
|
meaning
|
Example
|
|
+
|
Addition
|
3+4
|
|
-
|
Subtraction
|
5-7
|
|
*
|
Multiplication
|
5*5
|
|
/
|
Division
|
14/7
|
|
%
|
modulus
|
20%7
|
- Hasil operasi matematika akan mengikuti tipe data operand
- Operand bertipe int akan menghasilkan int
Ekspresi Aritmatika
Class Math dan Methodnya
|
Function
|
Returns
|
|
Math.sqrt(x)
|
Square root
|
|
Math.pow(x,y)
|
Power X
|
|
Math.exp(x)
|
E(x)
|
|
Math.log(x)
|
Natural log
|
|
Math.sin(x), math.cos(x), Math.tan(x)
|
Sine, cosine, tangent (x in radians)
|
|
Math.round(x)
|
Closest integer to x
|
|
Math.min(x, y), Math.max(x, y)
|
Minimum, maximum
|

Tidak ada komentar:
Posting Komentar