I need help creating a grade calculator in C. I am not allowed to use conditional statements. My problem is that I have written code to determine how many total points the student has, but I cannot think of a way to classify those points as an A (90-100), B (80-89), etc. without using conditional statements. My teacher gave us a hint and told us to use

and then a printf statement.

I understand somewhat where he's going, but not how to put it all togethor to acheive my goal. Any thoughts?

I suppose one way to do it would be to create an array of 101 characters, each array element represents the numeric grade. The use the grade to index into that array. For example

``````char grades[101] = {0};

int score = 93;

I suppose one way to do it would be to create an array of 101 characters, each array element represents the numeric grade. The use the grade to index into that array. For example

Or create an array of 11 characters

``````char grades[11] = {'J' ,'I', 'H' ,'G', 'F' ,'E','D', 'C', 'B', 'A', 'A'};

// now code to get grade
int score = 93;

Are you allowed to use relational operators ?

If yes you could do something of this sort

``````total_marks= 85                             //For example if the total marks are 85