int sum(int* numbers, int numbersCount)
{
if(numbersCount<=1) return 0;
int min = INT_MAX;
int max = INT_MIN;
int sum = 0;
for (int i = 0; i<numbersCount; i++)
{
if(numbers[i]>max) max = numbers[i];
if(numbers[i]<min) min = numbers[i];
sum+= numbers[i];
}
return sum-min-max;
}
Sum without highest and lowest number
Copyright © 2017 Powered by LZH, Theme used GitHub CSS.