Added Maths Folder & Absolute Value Program

This commit is contained in:
PatOnTheBack 2019-08-07 21:58:58 -04:00
parent 15f2ebdd1d
commit 9751ac5e98

27
Maths/AbsoluteValue.java Normal file
View File

@ -0,0 +1,27 @@
package Maths;
/**
* @author PatOnTheBack
*/
public class AbsoluteValue {
public static void main(String[] args) {
int value = -34;
System.out.println("The absolute value of " + value + " is " + abs_val(value));
}
public static int abs_val(int value) {
// If value is less than zero, make value positive.
if (value < 0) {
return -value;
}
return value;
}
}