Respuesta :

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.