Hi guys I want to create a program that requests from the user 10 grades and then filters them to pass and fail, then prints the number of passes and fails. I did the program but the output is wrong.
int pass,fail,grade,studentcounter;
pass=0;
fail=0;
grade=0;
studentcounter=10;
while (studentcounter!=0)
{
printf("enter the next grade\n");
scanf("%d",grade);
student--;
}
switch (grade)
{
case 1:
if (grade >= 50)
pass++;
break;
case 2:
if (grade <= 49)
fail++;
break;
}
}
printf("the number of fail is %d",fail);
printf("the number of pass is %d",pass);
}
The problem is that the program request the ten grades but at the end it will print the number of fail and the number of pass as zero. Why?