Answer to Question #42180 in C++ for Yazid abubakar

Question #42180
write a c programme that accept 10 student grade and then calculate their average
1
Expert's answer
2014-05-09T08:50:23-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS