The program is written in Java using 'while loop' as required in which the user is asked to enter two numbers and then the program computes the sum through number 1 up to number 2 and then displays the result.
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Input first number: ");
int num1 = in.nextInt();
System.out.print("Input second number: ");
int num2 = in.nextInt();
int sum = 0;
while(num1 <= num2)
{
sum += num1;
num1++;
}
System.out.println("Sum of all numbers through num1 to num2 = " + sum);
}
}
The program with its output is given in the attachment.
You can learn more about Java at
https://brainly.com/question/26642771
#SPJ4