i have done program as below. need to input no of students and no of subject.
no of subject and student is undefine. every entered marks should produce its grade.
in this case i've defined the no of subject by right it should be entered by user. how can i edit this to looks like this
enter no of student :
enter no of subject :
enter student id:
mark for id is:
#include <stdio.h>
void main(){
float average,total_mark;
int noStud, StudID, noSub;
int num1, num2 , num3;
printf("\t\t\tGrading System\n\n");
printf("Enter no. of student: ");
scanf("%d", &noStud);
printf("Enter no of subject: ");
scanf("%d", &noSub);
printf ("\n\n\t>>Enter students ID:");
scanf ("%d" , &StudID );
printf ("\n\t>>Enter marks for %d:\n" , StudID );
printf ("\tEnter mark for subject English: ", &num1);
scanf("%i", &num1);
if (num1 >= 80 && num1 <= 100)
printf ("\tGrade: A\n");
else if ((num1 >= 70 && num1 <=79))
printf ("\tGrade: B\n");
else if ((num1 >=60 && num1 <=69))
printf ("\tGrade: C\n");
else if ((num1 >= 50 && num1 <=59))
printf ("\tGrade: D\n");
else if ((num1 >= 40 && num1 <=49))
printf ("\tGrade: E\n");
else if ((num1 >=0 && num1 <=39))
printf ("\tGrade: F\n");
printf ("\tEnter mark for Mathematic: ", &num2);
scanf("%i", &num2);
if (num2 >= 80 && num2 <= 100)
printf ("\tGrade: A\n");
else if ((num2 >= 70 && num2 <=79))
printf ("\tGrade: B\n");
else if ((num2 >=60 && num2 <=69))
printf ("\tGrade: C\n");
else if ((num2 >= 50 && num2 <=59))
printf ("\tGrade: D\n");
else if ((num2 >= 40 && num2 <=49))
printf ("\tGrade: E\n");
else if ((num2 >=0 && num2 <=39))
printf ("\tGrade: F\n");
printf ("\tEnter mark for Science: ", &num3);
scanf("%i", &num3);
if (num3 >= 80 && num3 <= 100)
printf ("\tGrade: A\n");
else if ((num3 >= 70 && num3 <=79))
printf ("\tGrade: B\n");
else if ((num3 >=60 && num3 <=69))
printf ("\tGrade: C\n");
else if ((num3 >= 50 && num3 <=59))
printf ("\tGrade: D\n");
else if ((num3 >= 40 && num3 <=49))
printf ("\tGrade: E\n");
else if ((num3 >=0 && num3 <=39))
printf ("\tGrade: F\n");
total_mark=num1+num2+num3;
printf ("\nTotal Marks = %.2f\n", total_mark);
average=total_mark/noSub;
printf ("Average Marks = %.2f\n" ,total_mark/noSub);
if ( average >= 40)
printf ("PROCEED TO THE NEXT SEMESTER....\n");
else if (average <=39)
printf ("FAIL TO THE NEXT SEMESTER....\n");
system("pause");
return 0;
}