1. ## averaging program

How do would I incorporate a function that prints averages for each student in a class. I want to use A=1, B=2, C=3, D=4, and F=5. What would be the best way to go about doing this?

Thanks

Code:
```#include <stdio.h>

#define CLASS_SIZE  100

struct student {
char    *last_name;
int       student_id;
}

#include "cl_info.h"

int main(void)
{
struct student      temp,  class[CLASS_SIZE];

temp.last_name = "Smith";
temp.student_id = 39498;```

2. add all the grades up, divide by the number of grades, and that will give you a numerical average. If the average is 1.5, then it is somewhere between 'A' and 'B'. So you will need a series of if statements
Code:
```char Grade;
if( average >= 0 && average < 2)
else if (... // blabla```

3. LOL I got the numbers mixed up, but you've helped me anyway.
I meant to have A=4 and so on. Minor. Thanks for the help.

4. Do you want to just have each letter correspond to the number and print that? Should there be multiple grades that we're averaging (right now there's only that one char grade)? Did you want the class average instead? I dunno. I just couldn't see where averaging is coming into this problem

5. Originally Posted by Ancient Dragon
add all the grades up, divide by the number of grades, and that will give you a numerical average. If the average is 1.5, then it is somewhere between 'A' and 'B'. So you will need a series of if statements
Code:
```char Grade;
if( average >= 0 && average < 2)
else if (... // blabla```
or you could just use integer arithmetic which truncates to a whole number, or you could use floating point and rounding.....no need to use so many ifs.

6. Originally Posted by Tonto
Do you want to just have each letter correspond to the number and print that? Should there be multiple grades that we're averaging (right now there's only that one char grade)? Did you want the class average instead? I dunno. I just couldn't see where averaging is coming into this problem
I want it to be a letter grade for the average of each individual student. I haven't quite got the code working yet.

7. Code:
```const char letter_grades[] = { 'F', 'D', 'C', 'B', 'A' };