#include <stdio.h>
#include <stdlib.h>
int main()
{
struct student
{
char name[10];
int math;
int english;
};
// declare an array with the same structure
struct student classA[3] =
{{"Jay", 87, 69}, {"Jolin", 77, 88}, {"Henrry", 78, 70}};
int i;
float aveMath=0, aveEng=0;
for (i=0 ; i<3 ; i++){
printf("%s \t math= %d \t english= %d \n",
classA[i].name, classA[i].math, classA[i].english);
aveMath += classA[i].math;
aveEng += classA[i].english;
}
printf("============================\n");
printf(" Math average = %f\n", aveMath/3);
printf(" English average = %f\n", aveEng/3);
system("pause");
return 0;
}