Implement a function average_grade that returns a student's average grade.
If the student has not taken any courses, the average grade should be 0.0.
struct student {
int grade[20];
int count;
};
#include <stdio.h>
#include "grade.h"
float average_grade(struct student *std_ptr);
int main(void)
{
int i;
struct student std;
scanf("%d", &(std.count));
for(i = 0; i < std.count; i++)
scanf("%d", &(std.grade[i]));
printf("%f\n", average_grade(&std));
return0;
}
Number of subjects.
Score.
Ex.3
99 93 100
The average score.
Ex.97.333333