Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i need help with this code in c, i have: #include <stdio.h> int main() { int cou

ID: 3664961 • Letter: I

Question

i need help with this code in c, i have:

#include <stdio.h>

int main()
{
int counter;
float grade;
float total;
float average;
int pass;
int fail;
int students;
int remain;


total= 0;
counter= 0;
pass = 0;
fail = 0;
remain= students-=1;

printf("how many students took this test? ");
scanf("%d", &students);

while (counter < students)
{
printf("enter grade as a percentage for each student ");
scanf("%f", &grade);
if ( grade<=100 && grade>=0)
{

if(grade >= 60)
{printf("pass enter %d more grades ", &remain);
pass++;}

else
{printf("fail enter %d more grades ", &remain);
fail++;}

total= total + grade;
counter++;
}
else
{puts ("grades must be between 0 and 100");}
}

average=total/students;

printf(" class average is %f out of %d students %d passed and %d failed ", average, students, pass, fail);

return 0;}

I want it to display the number of grades i have left to enter and it keeps giving me a huge number. PLEASE HELLPPPP

ClUsers zachDocuments SCHOOLWINTER 20161Programmingquiz 2exe" how many students took this test? 10 en ter grade as a percentage for each student 20 fail enter 6356720 more grades enter grade as a percentage for each student

Explanation / Answer

use else if for calculating the grades

if(grade<=100 && grade>=0)

{

printf(“A”);

}

else if(grade>=60)

{

printf(“pass ”);

scanf(“%d”,&remain);

}

total=total+grade;

counter++;

}

else

{

prinf(“grades must be between 0 and100”);

}