I should have mentioned that the directions specifically say no "logical operators" rather than no if statements. So no switch or inlines. That array idea is genius... But I really don't think it would be allowed since we haven't talked about them yet.
This is the second assignment of a basic computer science course. While I've had some programming experience, many in the class are beginners. I imagine there is some sort of miscommunication that makes the problem overly difficult.
Maybe I'll come up with the answer by messing around with the ASCII codes more as it seems the likeliest of solutions.
unsigned int grade_index;
unsigned int score = 35; //this is your score. use scanf to get it.
grade_index = score/55 + score/65 + score/75 + score/85;
char grade = 69;
grade = grade - grade_index;
But that was not the question! The answer generated was correct under the conditions set by the teacher.
I know. But I still I feel my solution is not the perfect one. Why because, I gave away a non-generic solution. A code is not good if it works in some scenario but doesn't work in other. I gave a hint about the loop hole so that Mxous could put his own effort into correcting it.
The solution was the one intended by the professor. He gave a couple of hints because nearly everyone was complaining about it being impossible. And I think it is a good solution. If F was a 0-34 and D a 35-64, then