Write statements that can be used in a Java program to read two integers and display the number of integers that lie between them, including the integers themselves. For example, four integers are between 3 and 6: 3, 4, 5, and 6.

What will be an ideal response?


```
System.out.println("Greetings.");

int min, max;

Scanner keyboard = new Scanner(System.in);
System.out.println("Enter a minimum and maximum value");
min = keyboard.nextInt();
max = keyboard.nextInt();

System.out.println("The number of values in the range from " +
min + " to " + max + " is ");
System.out.println(max-min+1);


```

Computer Science & Information Technology

You might also like to view...

By default, an applet has no frame around it.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

An operating system is a computer program that coordinates all the activities of computer hardware.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

In an expression containing values of the types int and double, the ________ values are ________ to ________ values for use in the expression.

a. int, promoted, double. b. int, demoted, double. c. double, promoted, int. d. double, demoted, int.

Computer Science & Information Technology

Software forensics tools are commonly used to copy data from a suspect’s disk drive to a(n) ____.

A) backup file. B) firmware. C) image file. D) recovery copy.

Computer Science & Information Technology