View Code of Problem 612

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int cmp(const void*a,const void*b)
{
	return *((int *)a)-*((int *)b);
}
int main() {
	int a[6];
	while(scanf("%d",&a[0])!=EOF)
	{
		for(int i=1;i<6;i++)
		{
			scanf("%d",&a[i]);
		}
		qsort(a,6,sizeof(a[0]),cmp);
		float sum=(a[1]+a[2]+a[3]+a[4])/4.0;
		printf("%g\n",sum);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 612