-
Notifications
You must be signed in to change notification settings - Fork 0
/
mathMethodsDemo.java
37 lines (30 loc) · 1.5 KB
/
mathMethodsDemo.java
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
37
public class mathMethodsDemo {
public static void main(String[] args) {
// double number = 2;
// double nthPower = 15;
// double powValue = Math.pow(number, nthPower);
// System.out.println(number + " to the power of " + nthPower + ": " + powValue);
// int n = 2;
// int p = 15;
// int powValue2 = (int) Math.pow(n, p);
// System.out.println(n + " to the power of " + p + ": " + powValue2);
// System.out.println();
// double someNumber = 16;
// double squareRoot = Math.sqrt(someNumber);
// System.out.println("The square root of " + someNumber + " is: " + squareRoot);
// int integerNumber = -34;
// int absoluteValue = Math.abs(integerNumber);
// System.out.println("The absolute value of " + integerNumber + " is: " + absoluteValue);
// System.out.println();
// double decimalNumber = -4.56;
// double decimalAbsValue = Math.abs(decimalNumber);
// System.out.println("The absolute value of " + decimalNumber + " is: " + decimalAbsValue);
// System.out.println();
// double myRadius = 3.5;
// double myCircumfrence = 2 * Math.PI * myRadius;
// System.out.println("The circumfrence of a circle with a radius of " + myRadius + " is: " + myCircumfrence);
// int randNumber = (int) (Math.random() * 5);
// System.out.println("A random number between 0 and 5: " + randNumber);
System.out.println(Math.random());
}
}