Question: Write a Java program, Using the code i have pasted please add another code to read the number of integers between the two numbers put
Write a Java program, Using the code i have pasted please add another code to read the number of integers between the two numbers put in the keyboard. Forexample, if the first # is 2 and the second # is 5, the program should display in the output 4. I do not need the display of the list of the numbers. Thanks
import java.util.Scanner; public class Assignment4 { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.print("Enter the first integer: "); int first = s.nextInt(); System.out.print("Enter the second integer: "); int second = s.nextInt(); System.out.println("How many integers are between "+first+" and "+second+"???"); // your code goes here!!!! } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
