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
The difrent between valid deductive argument and strong inductive argument? At least 2 example​
Artemon [7]

Answer:

If the arguer believes that the truth of the premises definitely establishes the truth of the conclusion, then the argument is deductive. If the arguer believes that the truth of the premises provides only good reasons to believe the conclusion is probably true, then the argument is inductive.

ALSO

Deductive arguments have unassailable conclusions assuming all the premises are true, but inductive arguments simply have some measure of probability that the argument is true—based on the strength of the argument and the evidence to support it.

Explanation:

5 0
3 years ago
Larry does not want to save his Internet browsing details on his computer what files delete to clear his information from the co
GREYUIT [131]
He would have to clear his history or use incognito tabs from then on.
5 0
3 years ago
Each object that is created from a class is called a(n) ____________ of the class.
gladu [14]
Instance





-------------------------
7 0
3 years ago
Read 2 more answers
When you take a multiple-choice test, you are relying on ________, a means of retrieving information out of your long-term memor
Karolina [17]

Answer:b)Recognition

Explanation: Recognition method is the technique which is based upon the similarity of the structure.It basically compares between the received format and the format of the reference on the basis of their structure.It is considered as a good method of the retrieving the image or format which is in storage. This usually results in opting the correct answer or option.

Therefore, the correct answer is option (b).

8 0
3 years ago
A popular photo editing application provides customers with the option of accessing a web based version through a monthly subscr
Black_prince [1.1K]

Answer:

photoshop app that purchase with a lower price 3$ per month

6 0
2 years ago
Other questions:
  • Jason is an aspiring filmmaker. He manages finance and makes sure that everyone is involved in the project. Which role is Jason
    12·1 answer
  • When you compose a message, you want your audience to find the information it needs quickly and to understand what it finds. You
    11·1 answer
  • 1. Which plot element is typically the turning point and the most intense moment of a story? (1 point)
    11·2 answers
  • A security policy is a
    11·1 answer
  • The term “computer literacy” dates back to what decade? <br> 1960s<br> 1970s<br> 1980s<br> 1990s
    5·1 answer
  • When a compiler finds errors, it usually indicates what they are so you can correct the code and compile the program again?
    11·1 answer
  • Using ________ as a promotion method will bring return visitors to your site.
    8·1 answer
  • I really need this done Thank you!!
    6·1 answer
  • Nathan has a 30-second clip of music that he wants to play over and over again when he runs a program. What does Nathan need to
    5·2 answers
  • Who wants brainlyest! NO LINKS how do you message someone on brainly
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!