Question: Ask the user for two integers and then output the distance between the two numbers (absolute value of the difference). import java.util.Scanner; public class Distance
Ask the user for two integers and then output the distance between the two numbers (absolute value of the difference).
import java.util.Scanner;
public class Distance { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); System.out.println("Enter two integers:"); int a; int b; int dist; System.out.println("Distance between " + a + " and " + b + " is " + dist + " units"); } }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
