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
NEED HELP AGAIN
Anestetic [448]
The answer to the question is D)
8 0
3 years ago
Read 2 more answers
"The effectiveness of memory retrieval is directly related to the similarity of cues present when the memory was encoded to the
alexdok [17]

Answer:

D

Explanation:

Cause You Have To Decode It To Get To The Memory In The First Place

3 0
3 years ago
Complete the sentence.
mojhsa [17]

Answer:

its a network

Explanation:

that is how it is called

7 0
3 years ago
Whenever I go onto Google Chrome, the words are in Spanish! How can I make the words be back in English again? Please let me kno
ivann1987 [24]

Answer:

Go to google setting look up english on setting bar and it should have the option to change or add languages make sure you press save when choosing english

Explanation:

5 0
3 years ago
Please help me with computing!
Sladkaya [172]

Answer:

ok i help

Explanation:

3 0
3 years ago
Other questions:
  • What attributes a website indicates a more reliable source for information
    14·1 answer
  • The control programs managing computer hardware and software perform the _________ function to control and prioritize tasks perf
    8·1 answer
  • What data does Bittorrenting uses? Explain.
    5·1 answer
  • What Intel socket recommends the use of a liquid cooling system?
    12·1 answer
  • Jeremy is designing a website for a florist. He intends to discuss the web design with his client. Which tool should Jeremy use
    6·1 answer
  • A new employee has reported that print jobs are printing as garbled text. Which of the following is MOST likely the reason for t
    8·1 answer
  • Design a class FileArray that has a static method named writeArray. The method should take two arguments: the name of a file and
    11·1 answer
  • What does the action tool allow you to do in Microsoft Powerpoint?
    15·1 answer
  • 5 advantages in relation to virtual education in times of pandemic.
    10·1 answer
  • Consider a file/directory with the following info:
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!