int main ()
{
float *grade = (float *)malloc(10*sizeof(float)) ;
int i =0;
float max = 0,min = 100,average = 0 ;
float sum = 0 ;
printf("Please enter 10 grades...\n") ;
for(i =0 ;i < 10 ;++i)
{
scanf("%f",&grade[i]) ;
}
for(i = 0 ;i < 10 ;++i)
{
sum += grade[i] ;
if(min >grade[i])
{
min = grade[i] ;
}
if(max < grade[i])
{
max = grade[i] ;
}
}
average = sum/10.0 ;
printf("min = %f,max =%f,average = %f\n",min,max,average) ;
}
希望能帮助到你