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
Any game suggestions for nintindo switch.​
alexira [117]

Answer: animal crossing lol

Explanation:

7 0
3 years ago
Most companies compute the materials price variance when raw materials are _______. received from suppliers and transported to r
Ksju [112]

Answer:

Purchased.

Explanation:

when purchased materials are received from suppliers and transported to raw materials inventory rather than waiting to compute the price variance when the materials are withdrawn from raw materials inventory and used in production.  Also, computing the price variance when the materials are purchased allows materials to be carried in the inventory accounts at their standard cost.

4 0
3 years ago
You typed the word "weather" when you meant to type the word "whether." When will Writer or Word flag this as a misspelling or a
maria [59]

Answer:

It depends on the structure of the sentence.

Explanation:

This will be shown as grammatical mistake because both the spellings are correct. If we write the word weather instead of the whether, Ms word shows the grammatical mistake. This is because, if we want to write the word whether, we should use or in our sentence. Both of these words are comes together.

Example

I will take a leave whether its raining or not.

In above sentence, both whether and or comes together. If we write weather instead of whether it just show the grammatical mistake in the sentence.

4 0
3 years ago
Read 2 more answers
Who invented the first mechanical computer? in what year was it invented?.
Elodia [21]

Answer:

The first mechanical computer was invented by Charles Babbage in 1822.

6 0
2 years ago
Which of the following is one of the most important considerations when designing a website A. Purpose B. Budget C. Size D. Pict
Sladkaya [172]

answer would be A: purpose

7 0
3 years ago
Other questions:
  • What operating system uses Fastboot?
    10·2 answers
  • A number used to encrypt data is called a(n ________. signature key cookie escrow
    10·1 answer
  • What are operational databases
    12·1 answer
  • Chole enjoys her math classes, and she would like to find a career that will allow her to continue use her math skillls which ca
    10·1 answer
  • An attacker captures an encrypted message. he tries decrypting with every possible key until the decryption process reveals a se
    14·1 answer
  • What acronym describes networked devices that contain microcomputers but are not thought of as computing devices, such as refrig
    9·1 answer
  • What is the value of the variable index after the Python code below is executed? word = 'bAnana' index = word.find('a')
    10·1 answer
  • Design by contract considers the software system to be a setof:
    10·1 answer
  • What is the full form of MPEG?<br> The full form for MPEG is ________.
    9·1 answer
  • if we try to use tail-recursive rules to implement non-tail-recursive rules, it will normally result in rules that are
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!