try this code below
Code:
#include<stdio.h>
#include<conio.h>
#include <stdlib.h>
int main()
{
int x,y;
float score;
float sum = 0;
float ave = 0,max = 0;
char* name;
for(x=1;x<=4;x++)
{
name = (char*) malloc( sizeof(char) );
printf("Enter name %d : ", x);
gets(name);
sum = 0;
for(y=1;y<=5;y++)
{
printf("Enter score %d :", y);
scanf("%f", &score);
sum = sum + score;
}
fflush(stdin);
ave = (sum/5);
printf("The average score is %.2f \n", ave);
if(ave > max)
max=ave;
}
printf("The highest average is %.2f", max);
getch();
return 0;
}
fflush(stdin) will flush out all the contents in the input buffer including new line..
you can also use getchar() instead of fflush(stdin);