import java.util.Scanner;
public class demo1 {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Input 1st integer: ");
int firstInt = in.nextInt();
System.out.print("Input 2nd integer: ");
int secondInt = in.nextInt();
System.out.printf("Distance of two integers: %d%n", Math.abs(firstInt-secondInt));
System.out.printf("Max integer: %d%n", Math.max(firstInt, secondInt));
System.out.printf("Min integer: %d%n", Math.min(firstInt, secondInt));
}
}Java
Program to print distance, maximum, minimum value between integers.

Written by
View ProfileNikhil Juneja
Passionate software developer and technical contributor at TutorialsLink.
