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
mestny [16]
4 years ago
12

Create a C++ program that asks the user to enter 5 double values. Calculate the sum, average, max and min and display them on th

e console. Fully document the code.
Computers and Technology
1 answer:
worty [1.4K]4 years ago
5 0

Answer:

#include <bits/stdc++.h>

using namespace std;

int main() {

   double a[5]; //double array of size 5..

   cout<<"Enter 5 double values"<<endl;

   for(int i=0;i<5;i++)

   {

       cin>>a[i];//taking input of doubles.

   }

   double max=-10000000.0,min=10000000.0,avg,sum=0;

   for(int i=0;i<5;i++)//loop for calculating the sum ,finding the maximum and minimum.

   {

       sum+=a[i];

       if(a[i]>max)

       {

           max=a[i];

       }

       if(a[i]<min)

       {

           min=a[i];

       }

   }

   avg=sum/5.0;//calculating average.

   cout<<"The sum of the numbers is "<<sum<<endl

   <<"The average of the numbers is "<<avg<<endl

   <<"The maximum from the numbers is "<<max<<endl

   <<"The minimum from the number is "<<min<<endl;

return 0;

}

Output:-

Enter 5 double values

8.99 654.12 125841.5 21.0 256.2

The sum of the numbers is 126782

The average of the numbers is 25356.4

The maximum from the numbers is 125842

The minimum from the number is 8.99

Explanation:

I have taken an array of double variables of size 5 to store the numbers entered by the user.The I have looped over the elements and calculated the sum found the maximum,minimum and out of the loop calculated the average of the numbers.

You might be interested in
What command displays detail information about the OSPF interfaces, including the authentication method?
statuscvo [17]
<span>The answer is Show IP OSPF interface

Hope this helped :)</span>
8 0
3 years ago
Read 2 more answers
What role does the automated surface observing system.
Ilya [14]

Answer: The ASOS systems serves as the nation's primary surface weather observing network. ASOS is designed to support weather forecast activities and aviation operations

6 0
2 years ago
Read 2 more answers
Phoebe has to give a presentation about recycling. Where should she look while presenting?
Naddika [18.5K]
Well, I think that maybe the answer is B or C. She shouldn't only look at her presentation while she is presenting it, that doesn't look professional, and you want to look at the people you are talking to.
6 0
3 years ago
Read 2 more answers
What is the Difference between CUI and GUI
Fynjy0 [20]

Hi there!


GUI Means Graphical user interface


CUI means  Controlled Unclassified Information


Theres the difference they are completely different from each other.


PLEASE MARK BRAINLIEST

-WeasuLL

7 0
3 years ago
Read 2 more answers
Please help What two Boolean operators can you use to narrow your search results?
daser333 [38]

Answer:

if and and not and or ans all

7 0
3 years ago
Other questions:
  • Which animation effects allow text or images to show movement on a slide? Check all that apply. Entrance, Emphasis, Exit, Motion
    5·2 answers
  • In a linked chain implementation of a queue, the performance of the enqueue operation
    10·1 answer
  • Experienced students may serve as mentors if they are at least age 21 and have at least 3 years of post-secondary education. In
    5·1 answer
  • Which famous individuals was born on october 31st?
    7·1 answer
  • Evolucion de los sistemas operativos
    5·1 answer
  • Arrays of structures ________. Group of answer choices None of the above. are automatically passed by reference cannot be passed
    6·1 answer
  • Sabiendo que z1 = 10, z2 = 20, z3 =10 , z4 = 20, n1 = 1200 rpm.
    6·1 answer
  • Can you help me with this question please ​
    13·1 answer
  • Convertbinary(111100)to decimal​​​​
    13·2 answers
  • The technologist has recorded the red cell morphology as macrocytic. which mcv value would confirm this observation?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!