-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMathDemo.java
More file actions
28 lines (20 loc) · 773 Bytes
/
Copy pathMathDemo.java
File metadata and controls
28 lines (20 loc) · 773 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
package BeginnerJava;
import java.util.Scanner;
public class MathDemo {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int x = 4, y = 2;
int max = Math.max(x, y);
System.out.println("Maximum result is: "+max);
int min = Math.min(x, y);
System.out.println("Minimum result is: "+min);
int absolute = Math.abs(y);
System.out.println("Absolute value of Y: "+absolute);
double power = Math.pow(x, y);
System.out.println("X to the power Y: "+power);
int round = Math.round(8.4f);
System.out.println("Round of 8.4: "+round);
double pi = Math.PI;
System.out.println("Value of pi: "+pi);
}
}