1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sertanlavr [38]
3 years ago
8

This the code from the last post I did

Computers and Technology
1 answer:
Andrew [12]3 years ago
3 0

import java.util.Scanner;

public class JavaApplication86 {

   

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       int x = 0, c = 0, sum = 0;

       while (true){

           x = scan.nextInt();

           System.out.println("You entered: "+x);

           if (x == -1){

               break;

           }

           sum += x;

           c++;

       }

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

       System.out.println("You entered "+c +" numbers");

   }

   

}

This works for me. Instead of subtracting one from c and adding one to sum, I used an if statement to break away from the while loop if the entered number is -1.

You might be interested in
Identify what algorithm or concept the following code relates to. void Sort(int array[], int tempArray[], int left, int right) {
galina1969 [7]

Answer:

Binary sort

Explanation:

Binary sort is one of the fastest search techniques used on arrays and other iterable data types. It algorithm sorts the array in ascending order then gets the item in the middle from which it divides the array to be searched in two parts. If the searched term is less than the mid item, then it is searched for in the first part, else it would be in the second.

4 0
2 years ago
The possible states of a process are:
Oliga [24]

Answer:

a. new, running, waiting, ready, and terminated.

Explanation:

The process in a computer system can have different states and these are:

-New: When the process is created.

-Ready: When the process is waiting to be executed.

-Running: When the process is chosen to be executed.

-Waiting: When the process is expecting for something to happen.

-Terminated: When the process is not running anymore.

According to this, the answer is that the possible states of a process are: new, running, waiting, ready, and terminated.

3 0
3 years ago
Read 2 more answers
You want to be able to access your home computer using remote desktop while traveling. you enable remote desktop, but you find t
solong [7]
Get a program for this perpose or perhaps get a new computer
5 0
3 years ago
Read 2 more answers
Which of the following is an example of a complex formula?
myrzilka [38]

Answer:

=A1<=A14

Explanation:

complex formula in excel is which contain more than 1 mathematical operators . An order of mathematical operations are important to understand

there are different type of operators

  • Arithmetic operators
  • Comparison operators
  • Text operators
  • Operators reference

here Comparison operator is an example of complex formula . Comparison operator returns TRUE/FALSE it is use to compare two values

= Equal to

< Less than

> Greater than

>= Greater than or Equal to

<= Less than or Equal to

7 0
3 years ago
Which HTML tags describe the meaning of the content?<br> describe the meaning of the content.
Nata [24]
Defines an HTML document
Contains metadata/information for the document
Defines a title for the document
5 0
2 years ago
Other questions:
  • Submit your 300-word essay describing the equipment usedI in a well-equipped studio’s audio department and the training and expe
    8·2 answers
  • Which of the following is not an advanced strategy you may use to help you conduct a search on the Internet?
    12·1 answer
  • What is the phase of a waveform ?
    15·1 answer
  • A device that make it possible for a muitiple customer to share one address is called
    13·1 answer
  • 1.Discuss why this class is important (or not) to a soon-to-be security practitioner. 2.Discuss one of more subjects you have le
    7·1 answer
  • give one word • pressure exerted by a stationary liquid _______. • force in a direction perpendicular to a given surface area __
    9·1 answer
  • Please need help.... The system development process is called a cycle. Which of the following may be an ongoing process which su
    6·1 answer
  • Drag each statement to the correct location.
    10·1 answer
  • Which of these statements correctly describe aspects of testing code? Check all of the boxes that apply.
    14·1 answer
  • SOMEONE PLEASE HELP ME WITH THIS ILL GIVE YOU BRAINLY IF YOU GET IT RIGHT PLEASE!!!!!
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!