package algorithmsample24;
import java.util.Scanner;
/**
*
* @author Nurhak
*/
public class AlgorithmSample24 {
public static void main(String[] args) {
int number1 = 0;
int number2 = 0;
int subResult = 0;
String data = "";
try {
Scanner scan = new Scanner(System.in);
System.out.println("Please enter the first number.");
data = scan.nextLine();
number1 = Integer.parseInt(data);
System.out.println("Please enter the second number.");
data = scan.nextLine();
number2 = Integer.parseInt(data);
subResult = number1 - number2;
System.out.println("Absolute value of subtraction is: " + Math.abs(subResult));
} catch (Exception e) {
System.err.println(e.toString());
}
}
}
Comments
Post a Comment