#include
#include
using namespace std;
const int maxn = 1024;
int arr[maxn];
void init(int n, int *Min, int *Max, int *sum)
{
for(int i = 0; i < n; i++)
{
scanf("%d", &arr[i]);
*Min = min(*Min, arr[i]);
*Max = max(*Max, arr[i]);
*sum += arr[i];
}
sort(arr, arr + n);
return;
}
int main(void)
{
int n; scanf("%d", &n);
int Min = 0x7fffffff, Max = 0x80000000, sum = 0;
init(n, &Min, &Max, &sum);
printf("%d %d %d\n", Min, Max, sum / n);
for(int i = 0; i < n; i++)
printf("%d ", arr[i]);
return 0;
}
void calc(int *p, int n, int &min, int &min, double &aver)
{
sort(p, p+n);
min = p[0];
max = p[n-1];
int i;
int sum = 0;
for(i = 0; i < n; ++i)
{
sum+=p[i];
}
aver = sum/n;
}
不会使用c语言呢