Skip to content

Instantly share code, notes, and snippets.

@anonur
Last active April 4, 2019 19:08
Show Gist options
  • Save anonur/b9a4c0cda3ec1f73b196e21879dd15fd to your computer and use it in GitHub Desktop.
Save anonur/b9a4c0cda3ec1f73b196e21879dd15fd to your computer and use it in GitHub Desktop.
#include<stdio.h>
int main(void)
{
unsigned int passes = 0;
unsigned int failures = 0;
unsigned int student = 1;
int result;
while(student <= 10) {
printf("%s","Enter result (1=pass,2=fail): ");
scanf("%d",&result);
if(result == 1) {
passes = passes + 1;
}//end if
else {
failures = failures + 1;
}//end else
student = student + 1;
}//end while
printf("Passed %u\n",passes);
printf("Failed %u\n",failures);
if(passes > 8) {
puts("Bonus to instructor!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment