- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmathOperation4.java
More file actions
Latest commit
17 lines (16 loc) · 588 Bytes
/
Copy pathmathOperation4.java
File metadata and controls
17 lines (16 loc) · 588 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// utility imports...
classmathOperation4 {
publicstaticvoidmain(String[] args) {
// Scanner object...
Scannerinput = newScanner(System.in);
// Taking input..
System.out.print("Enter a number: );
// input section...
double a = input.nextDouble(); // inputs can either be decimal or floating number..
// math operation to verify the absolute number...
double absValue = (double) (Math.abs(a));
// Displaying output...
System.out.println("Absolutevalueis: " +absValue);
input.close(); // if doesn't,, resoource will be leaked...
}
}