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
Tom [10]
3 years ago
10

(Count positive and negative numbers and compute the average of numbers) Write a program that reads an unspecified number of int

egers, determines how many positive and negative values have been read, and computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point number. Python
Computers and Technology
1 answer:
Papessa [141]3 years ago
7 0

Answer:

Explanation:

Sorry it  is in Java, though you can covert it using converter

public class Exercise {

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 int positives = 0;  // Count the number of positive numbers

 int negatives = 0;  // Count the number of negative numbers

 int count = 0;   // Count all numbers

 double total = 0;  // Accumulate a totol

 // Promopt the user to enter an integer or 0 to exit

 System.out.print("Enter an integer, the input ends if it is 0: ");

 int number = input.nextInt();

 if (number == 0) { // Test for sentinel value

  System.out.println("No numbers are entered except 0");

  System.exit(1);

 }

 while (number != 0) {// Test for sentinel value

  if (number > 0)

   positives++; // Increase positives

  else

   negatives++; // Increase negatives

  total += number; // Accumulate total

  count++;    // Increase the count

  number = input.nextInt();

 }

 // Calculate the average

 double average = total / count;

 // Display results

 System.out.println(

  "The number of positive is " + positives +

  "\nThe number of negatives is " + negatives +

  "\nThe total is total " + total +

  "\nThe average is " + average);

}

}

You might be interested in
Thomas is getting ready for a presentation. His slides are set, and he's
Harrizon [31]
I think the answer is B because all of the other ones dont make sense and wouldnt work in a time crunch
5 0
4 years ago
Read 2 more answers
Which of the following is an example of a syntax error?
Yuri [45]

Answer:

misspelling a programming language word

Explanation:

Syntax error is the type of error in programming, when the programmer insert some symbol that is not present in directories or libraries, the programmer not followed the rules of that particular programming language that is understandable to compiler.

For example in C++, it is necessary to insert the semicolon (;) after each statement. If the programmer not insert the semicolon after each statement, the program will show the syntax error.

If the programmer use integer instead of int to assign datatype to the variable in C++, it will also leads to the syntax error. Because in C++ library, Integer is defined with the help of "int".

4 0
3 years ago
Continuous data
Elena-2011 [213]

Answer: Could be subdivided into smaller and smaller units.

Explanation:

 The continuous data are basically measured in the small units and can be easily subdivided into smaller parts without changing their actual meaning.

The continuous data also contain numeric value and can be divided into smaller and finer meaningful parts.

The continuous data can be measured according to the precision of the system. The size and volume are the example of the continuous data.

7 0
4 years ago
What does the<br> command do
I am Lyosha [343]
Please specify your question.
6 0
3 years ago
Which of the following statements about light-emitting diodes is correct?
defon

The correct answer if B

4 0
3 years ago
Other questions:
  • What is the difference between operating systems and application software?
    6·2 answers
  • You use worksheets to perform calculations. How do you perform these calculations? ______ are used for performing calculations i
    12·2 answers
  • What are some areas to fill out in the New Formatting Rule dialog box? Check all that apply.
    13·2 answers
  • The false reject rate describes the number of legitimate users who are denied access because of a failure in the biometric devic
    11·1 answer
  • Which type of memory helps in reading as well as writing data?
    7·1 answer
  • Place the steps in order for manually creating a New Contact Group
    10·2 answers
  • List the main industries in Sierra Leone​
    5·1 answer
  • List any four e-commerce website​
    5·2 answers
  • Which of the following controls computer memory?
    13·1 answer
  • What is containment and why is it part of the planning process
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!