1. ## C homework help

Need help finding out how to create a program that allows professor to enter grades and the program has to calculate the grades and order them into As Bs Cs ect 100-89.5 =A 89.4-79.5=B so on and so on it should look something like this at the end for example

Enter next score (negative to stop) -- 89.5
Score = 89.50 Grade = A
Enter next score (negative to stop) -- 89.49
Score = 89.49 Grade = B
Enter next score (negative to stop) -- 90
Score = 90.00 Grade = A
Enter next score (negative to stop) -- 105
Sorry, scores cannot exceed 100. Please re-enter -- 58
Score = 58.00 Grade = F
Enter next score (negative to stop) -- 70
Score = 70.00 Grade = C
Enter next score (negative to stop) -- 65
Score = 65.00 Grade = D
Enter next score (negative to stop) -- -1

-------------------------
Number of scores 6
Number of A's 2
Number of B's 1
Number of C's 1
Number of D's 1
Number of F's 1
High score 90.00
Low score 58.00
Average score 77.00
Exam GPA 2.33
-------------------------

and the program has to be able to distinguish as many scores as the professor enters regardless, so i assume i need a loop of some sort

so far i have
{
int num;
printf("enter next score (negative to stop)\n");
scanf("%i",&num);
printf("score is %i \n", num);

return 0;
}

I dont know how to incorporate a loop and how to assign the letter grade along with it.
Yes i am a noob

2. I would suggest that you study this link Control structures along with Arrays, plus I would think that your course textbook would also be a place to review.

Jim

3. So you've gpot your code as follow

Code:
```{
int num;
printf("enter next score (negative to stop)\n");
scanf("%i",&num);
printf("score is %i \n", num);

return 0;
}```
You know the above code will read a value of the user and relay it back to the stdout. Try do this for n number of times. Thats is n being the max number of student for which you need to read the grades. This would be your first assignment. Like

Code:
```{
int num;

while ( .... ) {
printf("enter next score (negative to stop)\n");
scanf("%i",&num);
printf("score is %i \n", num);
}

return 0;
}```
while syntac is as follow

Code:
```while( condition )  while ( n < 10 ) { ... }
{
statment 1;
statment 2;
.
}```

Other other hand, you need to make an effort to solve the problem. Or your no where near to getting help on this forum. We would appreciate people working hard to what they desire and will help if your stuck, but not asking us to write the code for you.

ssharish

4. After a user inputs the score how do i make the printf(enter next score); pop up again ive tried it in loops but it never stops and i need to know how to set it to where when the user inputs a negative number the program stops and it relays the information and data on test scores, like i have in the example above

5. you can also use if else if statements and logical operators!

check the below link. Similar to what you want
Code:
`http://cboard.cprogramming.com/c-programming/134066-please-help-me-question.html`

6. Originally Posted by camel-man
After a user inputs the score how do i make the printf(enter next score); pop up again ive tried it in loops but it never stops and i need to know how to set it to where when the user inputs a negative number the program stops and it relays the information and data on test scores, like i have in the example above
By including it in a loop.... that's what everyone is telling you, a couple have even given rough examples...

Look in your C texts and documentation, see how loops work... then give it a try...

7. here is something quick to get u thinking. Try do while and if else if statements

so i said DO i.e. execute the statement enter score at least once. When the user enters the score, it looks at the if statements and displays the respective message AND THE STATEMENT "enter score" is repeated. If user inputs a negative score the program exits

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

int main()
{
int score;
//assigning a character to each variable

do
{
printf("Enter score: ");
scanf_s("%d",&score);

//compare imput with logical operator. If score is greater than 50 then display below msg
if (score>50 && score<80)
{

}

else if (score>80 && score<100)
{