Code:
#include<stdio.h>
int calcAbvAvg(int marks[10], int avg)
{
int students = 0;
int i;
for(i=0;i<10;i++)
{
if(marks[i] > avg)
{
students++;
}
}
printf("Students above average = %d",abv_avg);
printf("Students below average = %d",10 - abv_avg);
}
main (void)
{
int marks[10];
float avg;
int min = 100;
int max = 0;
int tot = 0;
int count;
int abv_avg = 0;
for (count=0;count<10;count++)
{
printf("Enter marks for student %d",count+1);
while(scanf("%d",&marks[count) != 1)
{
printf("\nWrong input\nEnter marks for student %d",count+1);
fflush(stdin);
}
if(min > marks[count])
{
min = marks[count];
}
if(max < marks[count])
{
max = marks[count];
}
}
for (count=0;count<10;count++)
{
total += marks[count];
}
avg = total/10;
abv_avg = calcAbvAvg(marks, avg);
printf("Minimum marks = %d",min);
printf("Maximum marks = %d",max);
printf("Average marks = %0.2f",avg);
calcAbvAvg(marks, avg);
}
I suck at function and linked list
can u help me with this question! the only problem i am having in this question is the function calcAbvAbg() not working! i want that function to display the students who are above and below average!