question..
You are required to write a complete C program for a simple grading system. At the beginning of the system, you need to input number of students and number of subjects that have been marked. Then, you need to enter the student's identification number and marks for each subject. While entering the marks, you have to determine their respective grades.
i m new to c programming...at least i have created something as below and need helps...
below is the program that i've created but i have problem to run like this :
enter no of student: which is x
enter no of subject: which is y
enter student id: such as 123
mark for 123 is :
enter mark 1:
grade ?
enter mark 2:
grade ?
enter mark 3:
grade.....
and so on..
total marks:
average mark is:
the problem is i cannot define no of student and subject as what i created...
how to change this to fullfil above format...
#include <stdio.h>
int main()
{
int count = 0;
char letter_grade = 'x';
int a = 0, b = 0, c = 0, d = 0, e = 0;
int student_ID = 1;
double test1 = 0.0, test2 = 0.0, final_test = 0.0, semester_average = 0.0,
do
{
printf("Enter student ID, 0 to terminate: ");
scanf("%d", &student_ID);
if(student_ID != 0)
{
printf("Enter score #1: ");
scanf("%lf", &test1);
printf("Enter score #2: ");
scanf("%lf", &test2);
printf("Enter score #3: ");
scanf("%lf", &final_test);
printf("%d have the following scores: %lf, %lf and %lf\n", student_ID, test1, test2, final_test);
semester_average = (0.20*test1) + (0.30*test2) + (0.50*final_test);
printf("The semester average score for %d is %lf\n", student_ID, semester_average);
if(semester_average >= 80)
{ letter_grade = 'A'; a++; }
else if (semester_average >= 65)
{ letter_grade = 'B'; b++; }
else if (semester_average >= 50)
{ letter_grade = 'C'; c++; }
else if (semester_average >= 40)
{ letter_grade = 'D'; d++; }
else if(semester_average >= 0)
{ letter_grade = 'E'; e++; }
printf("The grade for %d is %c\n", student_ID, letter_grade);
count++;
printf("Student #: %d\n", count);
return 0;
}