-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMathematicOperations.java
More file actions
36 lines (27 loc) · 1006 Bytes
/
MathematicOperations.java
File metadata and controls
36 lines (27 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
public class MathematicOperations {
public static void main(String[] args) {
double x = 2;
double y = 3;
System.out.println(Math.PI);
System.out.println(Math.E);
// devuelve un entero hacia arriba
System.out.println(Math.ceil(x));
// devuelve un entero hacia abajo
System.out.println(Math.floor(x));
// devuelve un numero elevado a otro numero
System.out.println(Math.pow(x,y));
// devuelve el numero mayor
System.out.println(Math.max(x,y));
// devuelve la raiz cuadrada
System.out.println(Math.sqrt(y));
// area de un circulo
// pi * r2
System.out.println(Math.PI* Math.pow(y,2));
// area de una esfera
// 4 * pi * r2
System.out.println(4 * Math.PI * Math.pow(y,2));
// volumen de una esfera
// (4/3) * pi * r3
System.out.println((4/3) * Math.PI * Math.pow(y,3));
}
}