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
What key do you press so you can switch tabs quickly?
ss7ja [257]
Alt and tab to switch to open applications
4 0
3 years ago
program that initialises a vector with the following string values: “what” “book” “is” “that” “you” “are” “reading”.
Zanzabum

A program that initializes a vector with the following string values: “what” “book” “is” “that” “you” “are” “reading” are the usage of namespace std;int main().

<h3>What is a vector software program?</h3>

Vector images software program permits customers to layout and manages pc photos the usage of geometric and mathematical commands, instead of clicks and strokes as utilized in drawing software program. Vector photos created the usage of those applications may be scaled indefinitely with out dropping quality.

  1. #include
  2. #include
  3. #include
  4. the usage of namespace std;
  5. int main()
  6. ;
  7. vector::iterator it;
  8. for (it = vs.begin(); it != vs.end(); it++)
  9. string tmp;
  10. while (cin.get()!='n')
  11. for (it = vs.begin(); it != vs.end(); it++)
  12. }

Read more about the vector :

brainly.com/question/25705666

#SPJ1

3 0
1 year ago
Angelina has added page numbers to her report, but all of the pages are labeled "Page 1" at the bottom. What caused
notka56 [123]

Answer:(A)

<em><u>Why?</u></em>

A footer is an area at the bottom of a document page that contains data common to other pages.

6 0
3 years ago
Read 2 more answers
State 5 different between mouse and keyboard​
Gekata [30.6K]

Answer:

*here you go *

Explanation:

While the main purpose of a mouse is to guide the cursor on the computer monitor, a keyboard is a typewriter like device with some additional functions that allow human interaction with computer. ... While mouse is considered to be a pointing device, keyboard is the input device for a computer.

(Keyboard vs Mouse

Keyboard and mouse are integral parts of a computer system and one cannot even think of interacting with the computer or monitor with the use of these two devices. In a sense, these two devices are the user interface that allows working on a computer system, and without them it is not possible to do anything on a computer. While the main purpose of a mouse is to guide the cursor on the computer monitor, a keyboard is a typewriter like device with some additional functions that allow human interaction with computer. In fact, a keyboard is the only source of providing the input to the computer and it performs the functions we ask it only with the help of this device.

While mouse is considered to be a pointing device, keyboard is the input device for a computer. Despite touch screen having been developed that allows one to use virtual keyboard onscreen, physical keyboard remains first choice of most of the individuals. There are keys with symbols printed on them in a keyboard and with the lightest of touches; the numeral or alphabet gets written on the screen of the monitor using a keyboard. There are some instructions for which one has to press a key and holding it pressed, another key has to be pressed. There are many shortcuts also used with the help of a keyboard that help save time and effort. Many computer commands are the results of these shortcuts. The major function of a keyboard is when one is using a word processor or a text editor.

A mouse is a pointing device and consists of a right and left clicks with a wheel in between that allows on to scroll up and down on a web page. The major function of a mouse is to control the cursor on the monitor of the screen. Today there are wireless mouse available that work through infrared rays.)

6 0
3 years ago
You add a style sheet link between which opening and closing tags?
Likurg_2 [28]

<link> tag

The <link> tag is most often used to link to external style sheets. The <link> element is an empty element, it contains attributes only.

8 0
2 years ago
Other questions:
  • Freya realizes she does not have enough in her bank account to use the debit card. She decides to use a credit card instead. Whi
    7·2 answers
  • The prediction that the number of transistors on a chip would double about every two years is known as ________. Metcalfe's law
    6·1 answer
  • Write the function "zipper". the function will take two array/list/table parameters and return a new array/list/table which will
    15·1 answer
  • PLEASE PLEASE PLEASE PLEASE HELP ASAP!!!!! I PROMISE I WILL GIVE YOU A BRAINLIEST FOR THE CORRECT ANSWER PLEASE HELP!!
    9·2 answers
  • Which of the following should you NOT do when using CSS3 properties to create text columns for an article element? a. make the c
    12·2 answers
  • What is an online reputation?
    12·2 answers
  • A two-dimensional array of characters can contain Group of answer choices
    11·1 answer
  • In general, smartphones do NOT hold as much personal information as tablets.
    11·1 answer
  • How many bytes does a common processor require to represent an integer?
    7·1 answer
  • WILL GIVE MORE POINTS, PLEASE HELP!!!
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!