#include
float average(int* a, int first, int last)
{
int s = 0;
for(int i = first; i <= last; ++i)<br> s += a[i];
return s * 1. / (last - first + 1);
}
int min_i(int* a, int n)
{
int m = a[0];
int numb = 0;
for(int i = 1; i < n; ++i)
if(m > a[i])
{
m = a[i];
numb = i;
}
return numb;
}
int max_i(int* a, int n)
{
int m = a[0];
int numb = 0;
for(int i = 1; i < n; ++i)
if(m < a[i])
{
m = a[i];
numb = i;
}
return numb;
}
int main()
{
int N;
std::cin >> N;
int X[N];
for(int i = 0; i < N; ++i)
std::cin >> X[i];
std::cout << "Average of whole array: " << average(X, 0, N - 1) << std::endl;<br> int first = min_i(X, N);
int last = max_i(X, N);
if(first > last)
{
int temp = first;
first = last;
last = temp;
}
if(last - first == 0 || last - first == 1)
std::cout << "Average of shorter array: " << average(X, 0, N - 1) << std::endl;<br> else
{
int delta = last - first;
for(int i = last; i < N; ++i)
X[i - delta + 1] = X[i];
std::cout << "Average of shorter array: " << average(X, 0, N - delta) << std::endl;<br> }
}