hello guys
*write a program that will calculate the average of an unknown number of students.
*your program should validate the grades to be between 0 and 100.
*there are 5 grades to be entered and averaged .
*the program should enter the grades using a for loop the calculate and print the average for that student .
*the program should continue until the user decided to stop the program.

test data
student 1 : 100 ,100, 100, 100 ,100 ave:100
student 2 :90, 95, 80, 88, 90 ave:88.6
student 3 :75, 89, 87, 79, 80 ave:82.0
student 4 : 101, 99, 89, 90, 90 ave :93.6
student 5 : 76, 65, 68, 50, 72 ave: 66.2
student 6 :63, 51, 57, 60, 60 ave:58.2

* modify your program to count the numbers of A's, B's, C's, D's, and F's averages.
use if statement.
* print the counts within a table form.
table ex: i. A: 2 B : 3 C: 1 D: 0 F : 1

*print a histogram graphically representing the counts
i. A: **
ii. B: ***
iii. C: *
iv. D:
v. F: *

* modify your program to calculate and print the class average .

i'm using c forum

#include "stdafx.h"
#include<stdio.h>

int main(void)
{

You will want to have three functions, imo: getInput(), main() to process the data, and printIt() to make your output.

Right now, I'd start with those three functions, and make a file with the data, which your program can read when it starts, saving you the time and effort of filling in the data, each time the program needs to be restarted. (During coding, that will happen many times.)

If you're not comfortable with using a file for this, then use arrays and variables to hold the data for you, in the program, while testing is on-going.Remove it after it's working correctly, and you need to write the actual input code the assignment wants.

Using two array's is recommended. One for the students name, and one for their marks. So students[0] will have all his marks in the columns of the marks[0][0], marks[0][1], marks[0][2], etc. The student row number in the string array of students, will correspond with that students marks in the marks array row number.

Get started on that - no one is going to do your assignment for you, I assure you. When you get stuck on something, post up your code with code tags around it, and let us know what the problem is.

The more specific your description is, the better the answers will probably be.

know how to start but when i put my code to validate the grades to be between 0 and 100.it's doesn't work
this is my codes

``````#include "stdafx.h"
#include<stdio.h>

int main(void)
{
int DONE = 0;
int n; //loop controller
int sum;
float average; //calculated student average

while (DONE == 0)
{
sum = 0;//initalize sum

for(n = 1; n <= 5; ++n)
{

}

average = sum/5.0;
printf("Student Average: %.2f\n", average);

printf("Have you finished entering students? 1 = Yes 0 = No\n");
scanf("%i",&DONE);

}

printf("Have a nice day\n");

return 0;
}``````

in this case the program runs good but when i put the code to validate the grades to be between 0 and 100. it's doesn't work

this is the coeds

// Do While Sample.cpp : F2011 90.211 Week 9
/*Write an interactive program to average 5 grades for
an unknown number of students and print the results
rounded to 2 places.

Special Instructions:
You must include a stopping element.
The average should be clearly labeled.
*/
//

``````#include "stdafx.h"
#include<stdio.h>

int main(void)
{
int DONE = 0;
int n; //loop controller
int sum;
float average; //calculated student average

while (DONE == 0)
{
sum = 0;//initalize sum

for(n = 1; n <= 5; ++n)
{

printf("Invalid entry. . . Try again\n");

}

average = sum/5.0;
printf("Student Average: %.2f\n", average);

printf("Have you finished entering students? 1 = Yes 0 = No\n");
scanf("%i",&DONE);

}

printf("Have a nice day\n");

return 0;
}``````

## thines01 401

Maybe something like this.
You'll probably have to fix the "press any key" thing.

``````#include "stdafx.h"
#include<stdio.h>
#include<conio.h>

int main(void)
{
int DONE = 0;
int n = 0; //loop controller
int sum = 0;
float average = 0.0; //calculated student average
char chrYesNo = 0;

do
{
sum = 0;//initalize sum
for(n=0; n<5; n++)
{

{
printf("Invalid entry. . . Try again\n");
n = n -1;
}

}

printf("Are you satisfied with those grades? [y/n]");

while(!kbhit())
{
}

getchar(); // clear the buffer
chrYesNo = getchar();

if( ('Y'==chrYesNo) || ('y'==chrYesNo))
{
DONE=1;
}

} while(DONE==0);

average = sum/5.0;
printf("Student Average: %.2f\n", average);

puts("Have a nice day\nPress any key to exit");
getchar();
getchar();
return 0;
}``````