I am trying to make a program so that the teacher can type in a number and it will output the corresponding alphabetical grade in C. Here is what I have so far, I am trying to make the console program stay open until a teacher types in exit or clicks the X icon. I appreciate any help.
#include <stdio.h>
#include<stdlib.h>
#define exit -1
int main(void) {
int grade;
printf("Enter student grade: ");
scanf_s("%d", &grade);
printf("Students grade is: %d", grade);
while (grade != exit) {
if (grade < 65)
{
printf("\nStudent grade is: F\n");
}
else if (grade <= 69)
{
printf("\nStudent grade is: D\n");
}
else if (grade <= 79)
{
printf("\nStudent grade is: C\n");
}
else if (grade <= 89)
{
printf("\nStudent grade is: B\n");
}
else if (grade <= 100)
{
printf("\nStudent grade is: A\n");
}
else if (grade == exit) {
#define EXIT_SUCCESS 0;
}
break;
}
printf("Enter student grade: ");
scanf_s("%d", &grade);
printf("Students grade is: %d", grade);
return 0;
}