Ask Question
17 December, 22:33

Write an application named SumInts that allows the user to enter any number of integers continuously until the user enters 999. Display the sum of the values entered, not including 999.

+4
Answers (1)
  1. 17 December, 22:41
    0
    import java. util. Scanner;

    public class num10 {

    public static void main (String[] args) {

    Scanner in = new Scanner (System. in);

    System. out. println ("Enter the numbers to add up. enter 999 to stop");

    int num = in. nextInt ();

    int sum = 0;

    while (num!=999) {

    sum = sum+num;

    System. out. println ("Enter the next number");

    num = in. nextInt ();

    }

    System. out. println ("The sum is: "+sum);

    }

    }

    Explanation:

    The application is implemented in Java

    A while loop is used to continously prompt user for inputs. The condition of the while loop is while (num!=999)

    When the number 999 is entered, it displays the sum which is initialized to 0
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write an application named SumInts that allows the user to enter any number of integers continuously until the user enters 999. Display the ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers