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

Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, a

nd 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. Sample Run 1 Enter an integer, the input ends if it is 0: 1 2 -1 3 0 The number of positives is 3 The number of negatives is 1 The total is 5.0 The average is 1.25 Sample Run 2 Enter an integer, the input ends if it is 0: 0 No numbers are entered except 0 Sample Run 3 Enter an integer, the input ends if it is 0: 2 3 4 5 0 The number of positives is 4 The number of negatives is 0 The total is 14 The average is 3.5 Sample Run 4 Enter an integer, the input ends if it is 0: -4 3 2 -1 0 The number of positives is 2 The number of negatives is 2 The total is 0 The average is 0.0
Computers and Technology
1 answer:
GarryVolchara [31]3 years ago
5 0

Answer:

<em>C++</em>

////////////////////////////////////////////////////////////////////////////////////////////////////////

#include <iostream>

#include <vector>

using namespace std;

int main() {

  vector<int> v;

   int n = 1;

   while (n != 0) {

       cout<<"Enter an integer, the input ends if it is 0: ";

       cin>>n;

       v.push_back(n);

   }

   cout<<endl;

   ///////////////////////////////////////////////////////////

   int sum = 0;

   int num_positives = 0, num_negatives = 0;

   for (int i=0; i<v.size()-1; i++) {

       if (v[i] > 0)

           ++num_positives;

       else

           ++num_negatives;

           

       sum = sum + v[i];

   }

   //////////////////////////////////////////////////////////

   cout<<"The number of positives is "<<num_positives<<endl;

   cout<<"The number of negatives is "<<num_negatives<<endl;

   cout<<"The total is "<<sum<<endl;

   cout<<"The average is "<<(float)sum/(v.size()-1);

   ///////////////////////////////////////////////////////////

   return 0;

}

You might be interested in
Write a program that prompts the user to enter an oligonucleotide sequence, such as TATGAGCCCGTA.
Alexxx [7]

Answer:

Explanation:

The following code is written in Python. It continues looping and asking the user for an oligonucleotide sequence and as long as it is valid it outputs the reverse complement of the sequence. Otherwise it exits the loop

letters = {'A', 'C', 'G', 'T'}

reloop = True

while reloop:

   sequence = input("Enter oligonucleotide sequence: ")

   for x in sequence:

       if x not in letters:

           reloop = False;

           break

   if reloop == False:

       break

   newSequence = ""

   for x in sequence:

       if x == 'A':

           newSequence += 'T'

       elif x == 'T':

           newSequence += 'A'

       elif x == 'C':

           newSequence += 'G'

       elif x == 'G':

           newSequence += 'C'

   print("Reverse Complement: " + newSequence)

7 0
3 years ago
Technology trends in education play a key role in a student’s: social life. motivation. career readiness. job search.
skelet666 [1.2K]

Answer:

job search

Explanation:

job search bc you can look for jobs that are avalible online.

4 0
3 years ago
Read 2 more answers
Which of these about non-disclosure agreements is accurate?
grandymaker [24]

Answer: number 2

Explanation: number 2

6 0
2 years ago
Read 2 more answers
What is a quick way to determine if a site might contain reliable information?
xz_007 [3.2K]
<span>The best and most correct answer among the choices provided by the question is the fourth choice.

A way of determining that a site is realiable is examining comments about the <span>webpage.</span></span><span>
I hope my answer has come to your help. God bless and have a nice day ahead!</span>
5 0
2 years ago
Read 2 more answers
The most direct way for jonathon to gain on-the-job experience and earn money while attending school is to apply for:
astraxan [27]
The most direct way for jonathon to gain on-the-job experience and earn money while attending school is to apply for: D:a work-study program
5 0
3 years ago
Read 2 more answers
Other questions:
  • How do smart watches affect the business and its position in the global marketplace?
    12·2 answers
  • A forensics workstation consisting of a laptop computer with almost as many bays and peripherals as a stationary workstation is
    10·1 answer
  • What is meant by backing up files through cloud computing?
    5·2 answers
  • Fill in the correct formula called a contains numbers from Rhodes 1 to 20 you can use the formula blank to find the volume of th
    14·1 answer
  • Which career involves analyzing various factors that influence the customer decision-making process?
    13·1 answer
  • What in the LAN for a small office, some user devices connect to the LAN using a cable, while others connect using wireless tech
    14·1 answer
  • From which type of data storage does the CPU load information for processing during normal operation?
    14·1 answer
  • Create the following new exceptions: PokemonException, which extends the Exception class. It must have a no-parameter constructo
    13·1 answer
  • It is a data being transported on a network​
    13·1 answer
  • Can someone please help me with this ,it is my assignment of technology and agriculture year 8
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!