#include <stdio.h>
char calcLetterGrade (int num_grade);
int main(void) {
char retValue=calcLetterGrade(101);
printf("The grade is: %c\n", retValue
); return 0;
}
char calcLetterGrade (int num_grade)
{
char letterGrade;
if ( num_grade >= 90 && num_grade <= 100 ){
letterGrade='A';
}
else if ( num_grade >= 80 && num_grade <= 89 ){
letterGrade='B';
}
else if ( num_grade >= 70 && num_grade <= 79 ){
letterGrade='C';
}
else if ( num_grade >= 60 && num_grade <= 69 ){
letterGrade='D';
}
else if ( num_grade >= 0 && num_grade <= 59 ){
letterGrade='F';
}
else if ( num_grade > 100 && num_grade < 0 ){
letterGrade='I';
}
return letterGrade;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CmNoYXIgY2FsY0xldHRlckdyYWRlIChpbnQgbnVtX2dyYWRlKTsKCmludCBtYWluKHZvaWQpIHsKCWNoYXIgcmV0VmFsdWU9Y2FsY0xldHRlckdyYWRlKDEwMSk7CiAgICBwcmludGYoIlRoZSBncmFkZSBpczogJWNcbiIsIHJldFZhbHVlKTsKCXJldHVybiAwOwp9CgpjaGFyIGNhbGNMZXR0ZXJHcmFkZSAoaW50IG51bV9ncmFkZSkKewogICBjaGFyIGxldHRlckdyYWRlOwogICAgCiAgICBpZiAoIG51bV9ncmFkZSA+PSA5MCAmJiBudW1fZ3JhZGUgPD0gMTAwICl7CiAgICAgICAgbGV0dGVyR3JhZGU9J0EnOwogICAgfQogICAgZWxzZSBpZiAoIG51bV9ncmFkZSA+PSA4MCAmJiBudW1fZ3JhZGUgPD0gODkgKXsKICAgICAgICBsZXR0ZXJHcmFkZT0nQic7CiAgICB9CiAgICBlbHNlIGlmICggbnVtX2dyYWRlID49IDcwICYmIG51bV9ncmFkZSA8PSA3OSApewogICAgICAgIGxldHRlckdyYWRlPSdDJzsKICAgIH0KICAgIGVsc2UgaWYgKCBudW1fZ3JhZGUgPj0gNjAgJiYgbnVtX2dyYWRlIDw9IDY5ICl7CiAgICAgICAgbGV0dGVyR3JhZGU9J0QnOwogICAgfQogICAgZWxzZSBpZiAoIG51bV9ncmFkZSA+PSAwICYmIG51bV9ncmFkZSA8PSA1OSApewogICAgICAgIGxldHRlckdyYWRlPSdGJzsKICAgIH0KICAgIGVsc2UgaWYgKCBudW1fZ3JhZGUgPiAxMDAgJiYgbnVtX2dyYWRlIDwgMCApewogICAgICAgIGxldHRlckdyYWRlPSdJJzsKICAgIH0KICAgIHJldHVybiBsZXR0ZXJHcmFkZTsKCn0g