#include?"stdio.h"
#include?"stdlib.h"
int?main(void){
int?n,i,max,sum,*pstu;
printf("How?many?studens?\nn=");
while(1){
if(scanf("%d",&n),n>0)
break;
printf("Error,?redo.?n?must?be?greater?than?0.\n");
}
if((pstu=(int?*)malloc(sizeof(int)*n))==NULL){
printf("Application?memory?failure...\n");
exit(0);
}
printf("Please?enter?%d?students?score...\n",n);
for(sum=max=i=0;i<n;i++){
scanf("%d",pstu+i);
sum+=pstu[i];
if(max<pstu[i])
max=pstu[i];
}
printf("The?average?is?%g\nThe?max?is?%d.?The?subscript:?",sum/(n+0.0),max);
for(i=0;i<n;i++)
if(max==pstu[i])
printf("%d?",i);
free(pstu);
printf("\n");
return?0;
}