Code:
/*Define maximum and minimum numeric grade values*/
#define LOW 0
#define HIGH 100
#define YES 1
#define NO 0
#define A 90
#define B 80
#define C 70
#define D 60
#define F 59
int grading (int score);
int main() {
int a_score, process, again, intvar;
again = YES;
printf("This program will assign a letter grade to a numeric test grade");
while ( again == YES) {
/*prompt user and call function to get the test grade, assign returned value to grade in main */
printf("\n\nPlease enter the numeric test grade. Grade must be between %d and %d: ", LOW, HIGH);
scanf("%d%*c",&a_score);
process = grading (a_score);
/*prompt user and call function to determine whether another test grade will be entered*/
printf("\nWould you like to enter another test grade? y/n");
scanf("%d%*c", &again);
}
return 0;
}
int grading (int score)
{
if (score >= A)
printf("Grade is A");
if (score < A)
printf("Grade is B");
return YES;
}
int repeat (again)
{
while (again == 'y' || again == 'Y')
return YES;
}