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
Luba_88 [7]
3 years ago
8

Write a function stats that takes an array and the number of elements in the array. Then, it computes and prints the minimum val

ue, maximum value, and the average value of all the values in the array. The output should be formatted with a two-digit precision. The function name: stats The function parameters (in this order): an array, double The number of elements in the array, int The function should not return anything.
Computers and Technology
1 answer:
BaLLatris [955]3 years ago
6 0

Answer:

#include<iostream>

using namespace std;

void stats(double [],int);  

int main()

{

int totalElements,i;

 

cout<<"Enter total elements:"<<endl;

cin>>totalElements;

double array[totalElements];

cout<<"Enter the elements in array:"<<endl;

for(i=0;i<totalElements;i++)

cin>>array[i];

stats(array,totalElements);  

}

void stats(double array[],int totalElements)

{

int i;

double minimum,maximum;

double Sum=0.0,average=0.0;

minimum=array[0],maximum=array[0];

for(i=0;i<totalElements;i++)

{

if(array[i]>maximum)

maximum=array[i];

if(array[i]<minimum)

minimum=array[i];

Sum+=array[i];

}

average=Sum/totalElements;

cout<<"Test: ";

for(i=0;i<totalElements;i++)

cout << fixed << setprecision(2) <<array[i]<<" ";

cout<<endl;

cout <<"minimum:"<< fixed << setprecision(2) <<minimum<<endl;

cout <<"maximum:"<< fixed << setprecision(2) <<maximum<<endl;

cout <<"average:"<< fixed << setprecision(2) <<average<<endl;

 

}

Explanation:

  • Loop through the total elements to get the input from user and call the stats function.
  • In the stats function check whether a number is maximum, minimum or average.
  • Calculate the average by finding the sum of all the numbers in array  and dividing it by total numbers.
  • Finally display the results.

You might be interested in
Microsoft word's spell checker?
vekshin1
The answer to the given picture is - Microsoft word's spell checker only recognizes very common words. Microsoft word has it's own dictionary which will be compared to the texts on your document. If they see an unfamiliar word they will underline it with red. Anyways you can add your own words and names to the custom dictionary.
8 0
3 years ago
HURRY PLS
gogolik [260]

Answer:

the testing team

Explanation:

because even though she may have fulfilled the requirements but she still need to test if it runs perfectly or not

7 0
1 year ago
Universal Containers needs the ability to generate contract documents. All the data required for a contract resides in a custom
Fittoniya [83]

Answer: (D) Select and install an App Exchange product to meet the contract generation needs.

Explanation:

The App exchange is the type of salesforce market place in the cloud platform and it included various types of cloud application and the services. We can select and then install the app exchange different types of product and services to meets the given generation needs.

The app exchange service is mainly used in the universal container that mainly needs for generating the document in the system. The user can able to install and access this type of app salesforce easily.

Therefore, Option (D) is correct.

 

6 0
2 years ago
How do we add questions on sam Blockly?​
Blizzard [7]

Answer:

I do not know that answer

5 0
3 years ago
Write a program that will ask the user to enter the amount of a purchase. The program should then compute the state and county s
iVinArrow [24]

Answer:

purchase_amount = float(input("Enter the amount of a purchase: "))

state_sales_tax = purchase_amount * 0.05

country_sales_tax = purchase_amount * 0.025

print("The amount of the purchase is " + str(purchase_amount))

print("The state sales tax is " + str(state_sales_tax))

print("The county sales tax is " + str(country_sales_tax))

print("The total sales tax is " + str(state_sales_tax + country_sales_tax))

print("The total of the sale is " + str(purchase_amount + state_sales_tax + country_sales_tax))

Explanation:

*The code is in Python.

Ask the user to enter purchase amount

Calculate the state sales tax, multiply purchase amount by 0.05

Calculate the county sales tax, multiply purchase amount by 0.025

Calculate the total sales tax, sum the state sales tax and county sales tax

Print the amount of the purchase, state sales tax, county sales tax, total sales tax and  total of the sale

7 0
3 years ago
Other questions:
  • If you want the date in your document to update each time the document is opened, _____.
    9·2 answers
  • An undesirable jagged appearance is referred to as
    7·2 answers
  • What kind of memory modules include registers between the system’s memory controller and the module’s memory chips, registers th
    7·2 answers
  • Which of the following definition below describes a wall opening?
    6·2 answers
  • Which of these are forms of data? Check all that apply.
    8·2 answers
  • How do you respond to an email?
    6·1 answer
  • A strategic information system can be any kind of information system that uses information technology to help an organization __
    11·1 answer
  • In Java:
    15·1 answer
  • Use the drop-down menus to answer the questions.
    6·1 answer
  • By definition, what is the process of reducing security exposure and tightening security controls?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!