Ask Question
31 December, 18:20

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.

+1
Answers (1)
  1. 31 December, 18:40
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers