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
Which character is used to begin a comment?
Aloiza [94]
# is used to begin a comment.
8 0
3 years ago
Which Supreme Court case resulted in a decree issued for the Michigan Department of Corrections to provide female inmates access
SOVA2 [1]

Answer:

GLOVER v. JOHNSON December 14th 1999 at Michigan

Explanation:

The court case mentioned above is exactly the court case that has ended with a decree being issued  through the Michigan Department of Corrections for providing female inmates the access to the programming which has previously been allowed only to the male inmates. And this happened in 1999, and some big names were part of the jurisdiction. Its a very popular case definitely.

7 0
2 years ago
There are two kinds of emotions: positive and negative. True False
fgiga [73]

Answer:

False

Explanation:

There are many emotions the human brain can experience

6 0
2 years ago
Read 2 more answers
Please help me with Excel!!! A lot of points!
yaroslaw [1]

Answer:

=((SUM(PUT RANGE OF MOTHLY EXPENSES HERE)*12)+SUM(PUT RANGE OF YEARLY EXPENSES HERE))/12

Explanation:

Adds all of the Monthly Expenses : SUM(PUT RANGE OF MOTHLY EXPENSES HERE)

Multiplies the result by 12: *12

Then adds all of the Yearly Expenses to the product of Steps 1 and 2 : SUM(PUT RANGE OF YEARLY EXPENSES HERE)

Divides this new sum by 12: /12

=((SUM(PUT RANGE OF MOTHLY EXPENSES HERE)*12)+SUM(PUT RANGE OF YEARLY EXPENSES HERE)/12)

6 0
3 years ago
What is used to configure data sources for applications that require access to a database?
Radda [10]
A network is used to configure data sources for applications that require access to a database?
6 0
3 years ago
Other questions:
  • Which of the following sentences uses the correct verb tense?
    8·2 answers
  • _____ is defined as an attraction for a source based on a resemblance between the source and receiver of a message.
    15·1 answer
  • You decide to configure ntp on the router to get time ntp server with an ip address of 172.17.8.254 which commanda should you us
    14·1 answer
  • I wanna start answering questions for people, but I don't quite know how. Can you help me?​
    13·1 answer
  • The variable most_recent_novel is associated with a dictionary that maps the names of novelists to their most recently published
    12·1 answer
  • (TCO C) When a remote user attempts to dial in to the network, the network access server (NAS) queries the TACACS+ server. If th
    14·1 answer
  • Your friend Margo is considering what type of display to purchase with her new desktop computer and she asks you for advice. You
    14·1 answer
  • Explain three specific & major security threats to internet users. In each case, address whether or not the vulnerabilities
    15·1 answer
  • While using a web-based order form, an attacker enters an unusually large value in the Quantity field. The value he or she enter
    15·1 answer
  • What's the commission payout for auto bill pay if sold with a ga?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!