I am trying to change the code i wrote to allow input from n students
I am trying to change the code i wrote to allow input from n students
instead of a set number. i have identifiy the n and interger students but it only reads the first student
below is the code and the what the output looks like
#include <stdio.h>
int main ()
{
/* variable definition: */
char StudentName[100];
float ExamValue, Sum, Avg;
int students,exams,n;
// Loop through n Students
for (; students <n ; students++)
{
// reset Sum to 0
Sum .0;
printf(“Enter Student Name \n”);
scanf(“%s”, StudentName);
// Nested Loop for Exams
for (; exams < 3; exams++)
{
printf (“Enter exam grade: \n”);
scanf(“%f”, &ExamValue);
Sum += ExamValue;
}
Avg = Sum/3.0;
printf( “Average for %s is %f\n”,StudentName,Avg);
}
return 0;
}
