#include <stdio.h>
char calcLetterGrade (int num_grade);
int main(void) {
char retValue=calcLetterGrade(90);
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+CmNoYXIgY2FsY0xldHRlckdyYWRlIChpbnQgbnVtX2dyYWRlKTsKCmludCBtYWluKHZvaWQpIHsKCWNoYXIgcmV0VmFsdWU9Y2FsY0xldHRlckdyYWRlKDkwKTsKICAgIHByaW50ZigiVGhlIGdyYWRlIGlzOiAlY1xuIiwgcmV0VmFsdWUpOwoJcmV0dXJuIDA7Cn0KCmNoYXIgY2FsY0xldHRlckdyYWRlIChpbnQgbnVtX2dyYWRlKQp7CiAgIGNoYXIgbGV0dGVyR3JhZGU7CiAgICAKICAgIGlmICggbnVtX2dyYWRlID49IDkwICYmIG51bV9ncmFkZSA8PSAxMDAgKXsKICAgICAgICBsZXR0ZXJHcmFkZT0iQSI7CiAgICB9CiAgICBlbHNlIGlmICggbnVtX2dyYWRlID49IDgwICYmIG51bV9ncmFkZSA8PSA4OSApewogICAgICAgIGxldHRlckdyYWRlPSJCIjsKICAgIH0KICAgIGVsc2UgaWYgKCBudW1fZ3JhZGUgPj0gNzAgJiYgbnVtX2dyYWRlIDw9IDc5ICl7CiAgICAgICAgbGV0dGVyR3JhZGU9IkMiOwogICAgfQogICAgZWxzZSBpZiAoIG51bV9ncmFkZSA+PSA2MCAmJiBudW1fZ3JhZGUgPD0gNjkgKXsKICAgICAgICBsZXR0ZXJHcmFkZT0iRCI7CiAgICB9CiAgICBlbHNlIGlmICggbnVtX2dyYWRlID49IDAgJiYgbnVtX2dyYWRlIDw9IDU5ICl7CiAgICAgICAgbGV0dGVyR3JhZGU9IkYiOwogICAgfQogICAgZWxzZSBpZiAoIG51bV9ncmFkZSA+IDEwMCAmJiBudW1fZ3JhZGUgPCAwICl7CiAgICAgICAgbGV0dGVyR3JhZGU9IkkiOwogICAgfQogICAgcmV0dXJuIGxldHRlckdyYWRlOwoKfSA=