In: Computer Science
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
//declare the variables
//assign 0 to max and 99999999 (large number) to
min
int max=0,min=99999999,i,n;
double midrange;
//loop to accept 10 values
for(i=0;i<10;i++)
{
cout<<endl<<"Enter a number";
cin>>n;//read the number from user
if(max<n) //condition for finding the largest
value
max=n;
if(min>n)//condition for finding the smallest
value
min=n;
}
midrange = (double)(max-min)/2; //compute the midrange value
//print the midrange value
cout<<endl<<"Midrange Value :
"<<fixed<<setprecision(2)<<midrange;
}
output