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]
2 years ago
8

This the code from the last post I did

Computers and Technology
1 answer:
Andrew [12]2 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
Huffman trees use the _________ of each character to work out their encoding. A) Frequency B) Order in ASCll
Maurinko [17]
I think the answer is C but I could be wrong
5 0
3 years ago
Which organization developed a network called CSNET to provide a network free to all American research and educational instituti
Citrus2011 [14]
<span>The National Science Foundation (NSF) is the organization which </span><span>developed a network called CSNET to provide a network free to all American research and educational institutions. It is an agency in the government of the United States that is responsible for research and development in the field of science and engineering. </span>
7 0
3 years ago
Do rats smell good? what do you think
irina1246 [14]

Answer:

Rats are not smelly animals. They are actually extremely clean animals and should not smell bad at all. ... A sick rat odor will smell like infection. Most likely if you are smelling your rats it is due to the cage and bedding not being cleaned often enough or from using the wrong type of litter and bedding.

Explanation:

7 0
3 years ago
Read 2 more answers
Technological developments over the past two decades, such as the rise of the internet and email, have
enyata [817]
Change our live because....
7 0
3 years ago
Read 2 more answers
Of the following occupations, which is predicted to have the greatest job growth?
klasskru [66]

Answer:

"Web designer" is the appropriate answer.

Explanation:

  • If we follow the market pattern, the number of purchases made by online shopping will continue to rise from 2002 to 2018 as well as the times to obtain no indication of slowing or stopping.
  • Because of the same, web designers are expected to have the greatest increase in jobs, as it is very important to customize the website so that online customers can appear more interactive.

So that the above is the correct answer.

6 0
3 years ago
Read 2 more answers
Other questions:
  • How do rubrics increase learning?
    15·2 answers
  • You have just been named Director of Data Administration of General Hardware Co. General Hardware maintains a large central IS o
    15·1 answer
  • How to Print output in JavaScript
    8·1 answer
  • What is an example of a source that is less likely to be copyrighted?
    7·2 answers
  • How is a website most likely to distinguish its different sections?
    8·1 answer
  • Complete the body of the decrement static method using only the NaturalNumberKernel methods (multiplyBy10, divideBy10, and isZer
    10·1 answer
  • Information technology has powerful effects on social behavior. Which of the following issues should NOT be expected when intera
    11·1 answer
  • What is an Algorithm? (might not be in the chapter text). Give an example.
    13·1 answer
  • What effect would excluding quotation marks from a search phrase have?
    12·1 answer
  • Three primary types of data that a forensic investigator must collect, in this order: 1.Volatile data 2.Temporary data 3.Persist
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!