#include <stdio.h>
#define SIZE 10
char grade(float GPA) {
if ( GPA > 91 && GPA < 100 ) {
return 'A';
}
if ( GPA > 83 && GPA < 91 ) {
return 'B';
}
if ( GPA > 74 && GPA < 83 ) {
return 'C';
}
if ( GPA > 65 && GPA < 74 ) {
return 'D';
}
if ( GPA > 0 && GPA < 65 ) {
return 'F';
}
}
int main() {
int grades[SIZE];
int i, sum = 0;
for ( i = 0; i < SIZE; i++ ) {
printf("Please enter stdent grade number %d\n", i+1 );
scanf("%d", &grades[i]);
sum += grades[i];
}
printf("The students GPA is %g\nGrade : %c\n", (double)sum/SIZE, grade(sum/SIZE));
return 0;
}
Comments
Leave a comment