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
The family size bottle of sunscreen holds 121212 fluid ounces (\text{fl oz})(fl oz)(, start text, f, l, space, o, z, end text, )
dolphi86 [110]

Answer:

The regular bottle holds 9 fluid ounces less than the family size bottle.

Explanation:

The family size bottle of sunscreen holds 12 fluid ounces

The regular bottle holds 75 percent less

75 percent of 12 = (75/100) X 12 =0.75 X 12 =9

Since the regular bottle holds 75% less, it holds 9 fluid ounces fewer fluid than the family size bottle of sunscreen.

NOTE: The regular size holds three(3) fluid ounces of sunscreen.

6 0
3 years ago
Technology can cause a drop in input costs.<br> a. True<br> b. False
Marizza181 [45]
<span>True that technology can cause a drop in input cost. In a production process, there are three kinds of cost that called input cost, which are the direct material cost, direct labor cost, and overhead cost. Technology usage can make the production process more efficient by reducing labors included in the process. This condition leads to a cost reduction.</span>
6 0
3 years ago
Read 2 more answers
HELP 99PTS If Answered
Alborosie

You will have to do this as we are not you and we do not know local business/websites. Sorry we could not help.

3 0
3 years ago
Read 2 more answers
What are two types of organizational structures designed to help an organization achieve its goals and objectives?
Fittoniya [83]

The answer is entrepreneurial and bureaucratic. Organizations that are large and small can achieve higher sales and other profit by properly matching their needs with the structure they use to operate.   the structure of an organization can help or hinder its progress toward accomplishing these goals and This are specific set up of organizations and ways to accomplish different goals. 

4 0
2 years ago
Read 2 more answers
Write a program that reads the contents of the two files into two separate lists. The user should be able to enter a boy’s name,
insens350 [35]

Answer:

Check Explanation.

Explanation:

A programming language is used by engineers, technologists, scientists or someone that learnt about programming languages and they use these programming languages to give instructions to a system. There are many types for instance, c++, python, Java and many more.

So, the solution to the question above is given below;

#define the lists

boyNames=[]

girlNames=[]

#open the text file BoyNames.txt

with open('BoyNames.txt','r') as rd_b_fl:

boyNames=rd_b_fl.readlines()

boyNames=[name.strip().lower() for name in boyNames]

#open the text file GirlNames.txt

with open('GirlNames.txt','r') as rd_b_fl:

girlNames=rd_b_fl.readlines()

girlNames=[name.strip().lower() for name in girlNames]

#print the message to prompt for name

print('Enter a name to see if it is a popular girls or boys name.')

while True:

#prompt and read the name

name=input('\nEnter a name to check, or \"stop\" to stop: ').lower()

# if the input is stop, then exit from the program

if name=='stop':

break

# If the girl name exits in the file,then return 1

g_count=girlNames.count(name)

# if return value greater than 0, then print message

if g_count>0:

print(name.title()+" is a popular girls name and is ranked "

+str(girlNames.index(name)+1))

# if return value greater than 0, then print message

#"Not popular name"

else:

print(name.title()+" is not a popular girls name")

## If the boy name exits in the file,then return 1

b_count=boyNames.count(name)

if b_count>0:

print(name.title()+" is a popular boys name and is ranked "

+str(boyNames.index(name)+1))

# if return value greater than 0, then print message

#"Not popular name"

else:

print(name.title()+" is not a popular boys name")

3 0
2 years ago
Other questions:
  • HEY DO U LIKE TRAINS!
    7·1 answer
  • ​printers, monitors,​ tablets, cpus, and laptops are examples of​ ____________.
    14·1 answer
  • Information is a valuable asset and not everyone in the world can be trusted with it. Therefore, we need to protect our valuable
    10·1 answer
  • By Carl Sandburg
    6·1 answer
  • E-mail has made it very easy to send a message to more than one person at any time of day from just about anywhere. If you wante
    12·2 answers
  • Which one of the following, in addition to disciplinary programs and drug-testing, can employers misuse as a form of retaliation
    8·1 answer
  • The HTTP protocol operates at which layer?
    7·1 answer
  • Three common risk factors for young drivers and how you plan to minimize these factors.
    13·1 answer
  • Laptop computers use PCMCIA cards, another type of ________
    15·1 answer
  • What is the name of the method generated when you double-click a button named btnprocess in the form designer?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!