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
Dennis_Churaev [7]
3 years ago
11

Write a program which asks the user to enter N numbers. The program will print out their average. Try your program with the foll

owing numbers: 20.5, 19.7, 21.3, 18.6 and 22.1
Computers and Technology
1 answer:
Likurg_2 [28]3 years ago
7 0

Answer:

// here is code in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables

int n;

double average,sum=0,x;

cout<<"enter the Value of N:";

// read the value of N

cin>>n;

cout<<"enter "<<n<<" Numbers:";

// read n Numbers

for(int a=0;a<n;a++)

{

   cin>>x;

   // calculate total sum of all numbers

   sum=sum+x;

}

// calculate average

average=sum/n;

// print average

cout<<"average of "<<n<<" Numbers is: "<<average<<endl;

return 0;

}

Explanation:

Read the total number from user i.e "n".Then read "n" numbers from user with for loop and sum them all.Find there average by dividing the sum with n.And print the average.

Output:

enter the Value of N:5

enter 5 Numbers:20.5 19.7 21.3 18.6 22.1

average of 5 Numbers is: 20.44

You might be interested in
Write a 3-4 page paper (500-800 words) about your project that explains your project, the type of conditioning you used, and the
sleet_krkn [62]

Answer:

Following are the responses to the given question:

Explanation:

I have decided to take up my project as a change in my behavior of not working out and exercising on daily basis. To execute this project, I decided to use ‘Operant conditioning’ to be able to complete it successfully. The reason for choosing this as my project is to be able to change my unhealthy behavior of not exercising daily, which is now having an impact on my weight as well as on my mind.

Operant Conditioning is also known as instrumental conditioning was used by the behaviorist B.F Skinner. Through operant conditioning, Skinner explained how we adapt to several learned behaviors in our everyday life. Its idea of such conditioning would be that the acts that accompany reinforcement will most likely occur in the future.

They may call it a punishment for actions and retribution. A relationship is formed between that action as well as its consequences. I began my project with an order of a watch to keep track of my daily workout and even downloaded a phone-based software to track my calorie each day. The concept behind it was to understand my everyday work and my calorie consumption because these variables inspire me to choose more to achieve my aim to practice and maintain my weight safely.

So, to find any way to miss it I did the routine calendar. We also made a small and comprehensive strategy for the first few weeks such as early awakening and 10 minutes getting warmed up. I concentrated on the operating conditioning function and reaction. I've been honored by enjoying my important topics for one hour every week that I finished my practice according to my planned routine. I wanted and award myself quarterly rewards in addition to daily rewards. When the goal of a daily exercise is also achieved, I decided to go out to my favorite coffee just at end of November.

It's not a matter of giving one of my favorite stuff to my cousins to affirm my everyday life except for one year within a week (except when I'm unwell). The fear of missing one of my items that I'd always agreed only at beginning of the week prevented me from achieving my target of exercise every day and made me very content to go to my favorite coffee shop. It made it more motivating for someone like me to proceed with the positive and negative reinforcement of doing my everyday exercise routine. I also get used to my fresh and safe routine every day, but also the results are impressive.

Even though I don't feel about rewarding myself with something that I like, I am very much happy because of the positive result which I have a fit body and maintain a healthy lifestyle. Those who removed my daily positive and negative exercise reinforcements, as well as the monthly incentive, could not be required in the future. Moreover, I can work on a closer look for 6 abs.

5 0
2 years ago
¿Por qué disminuyó el tamaño de la población de caribús? Usa la evidencia inicial para explicar por qué disminuyó el tamaño de l
scZoUnD [109]

Climate change, habitat destruction, and over-harvesting leading to a decrease in caribou populations. ... There are many possible causes of this decline, including: habitat destruction, climate change, and over harvesting.

7 0
2 years ago
3.A ball is thrown into the air with an initial velocity of 15 m/s. a.How long does it take the ball to reach maximum height?b.W
ehidna [41]

Answer:  a) = 1.5 sec.  b= 11.5 m. c=0  d= 1.5 sec.

Explanation:

a) Once thrown into the air , the only influence on the ball is gravity, so, we can conclude that the acceleration acting on the ball is the one due to gravity, i.e., g= 9.8 m/sec².

Applying the definition of acceleration, we can write the following equation:

a= (vf-vo) / t   ⇒ g = vf-vo / t. (1)

Now, when the ball reaches to his maximum height, it stops momentarily, and then starts to fall, so for this height, we can write vf=0.

Replacing  in (1), and solving for t, we get:

t = (0 -vo) / g = -15 m/s/ - 9.8 m/sec² (Taking upward as positive  direction)

a) t= 1.5 sec.

Replacing this value in the kinematic equation for displacement, when vo=15 m/s, we get:

hmax: 15 m/sec . 1.5 sec -1/2. 9.8 m/sec². (1.5 sec) ² (2)

b) hmax= 11.5 m

c) vf= 0 (as explained above)

Finally, in order to know how long the ball takes to return to its initial height, we know that for the falling part of the trajectory, vo=0, so we can write the equation for displacement as follows:

h=-hmax (because it returns to the same starting point)= 1/2 gt²=-11.5 m

Solving for t, we get:

d) t=1.5 sec.

It can be seen that the time used in going up, it is the same for going down, to travel the same distance.

This result is completely general and applies to any free fall problem.

3 0
3 years ago
Speech on inventors and inventions
vlada-n [284]
Interntors present an interesting kind of people who think in peculiar ways sometimes. This ability allows them to view certain situations in ways in which other people cannot. Because of this, they can think of new ways of how such situations can be tackled. This is how inventions are born. A person with an inventive mind sees a new situation where he thinks of a new solution how he could improve this situation with his invention.

This process is continued continuously with new generations of inventors seeing and coming back to old situations over and over again, inventing new things along the way. 
4 0
3 years ago
QUESTION: Which is not an example of a video port or cable?
Vikki [24]

Answer:

Radio Corporation of America (RCA)

Explanation:

A corporation is not a video connector.

8 0
3 years ago
Other questions:
  • Assume you're running a query on your orders in the past year. You want to see how many orders were placed after May. What type
    5·1 answer
  • Describe the major research, discoveries, or impact Timothy Berners-Lee has made on the scientific community. 100 points for ans
    6·1 answer
  • What does snap do need the answer now
    10·2 answers
  • (2) Design pseudocode for a program that accepts numbers from the user until the special number 555 is entered (you should use a
    12·1 answer
  • Send me the answers<br>​
    15·1 answer
  • How do Computer Scientists use Binary Code?
    14·1 answer
  • Role of memory in a computer system
    10·1 answer
  • Tạo thủ tục có tên _Pro04 để trả về số lượng tổng thời gian tham gia dự án Y của nhân viên có mã số X, với X là tham số đầu vào,
    5·1 answer
  • Select the correct answer from each drop-down menu.
    8·1 answer
  • The method used to transfer information to far off place instantly is called​
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!