#include <stdio.h>
#include <string.h>
struct stu
{
char Name[15];
int Rn;
float per;
} s1[100];
int main()
{
int i, n;
float avgper, sumper;
printf("Enter no. of Students:");
scanf("%d", &n);
for (i = 0; i < n; i++)
{
printf("Name:");
fflush(stdin);
gets(s1[i].Name);
printf("Roll no. :");
scanf("%d", &s1[i].Rn);
printf("Enter percentage");
scanf("%f", &s1[i].per);
}
//calculating sum of percentage of class
for (i = 0; i < n; i++)
sumper = sumper + s1[i].per;
//Average percentage of whole class
avgper = (float)sumper / n;
printf("Student(s) with percentage greater than average\n");
for (i = 0; i < n; i++)
{
if (avgper <= s1[i].per)
{
printf("\nName:");
puts(s1[i].Name);
printf("\nRoll no. %d", s1[i].Rn);
}
}
return 0;
}