Help
Posted by Flamez53
Last Updated: July 07, 2012
  953

Please Help
Something Is Wrong With My Code
But I Don't Know What
Please Tell

#include "stdio.h"
int main (void) {
    int passes = 0;
    int failures = 0;
    int student = 1;
    int result;
    
    while ( student <= 10 ) {
        printf (" enter result ");
        scanf ("%d", &result);
        
         if ( result == 1 ){
             passes = passes + 1;
         }
        
         else {
          
         failures = failures + 1;
    }
    student = student + 1;
    }
    printf ("  passed %d, ");
    
    printf ("  failed %d,  ");
    
    if (passes > 8) {
        
        printf (" bonus to instructor! \n");
        
    }
return 0;
}
   
  
 
 
   

 
 
Anyone viewing this can just ignore the please.i do not beg. I Have Pride.
 
Correction!!!!! you don't print the value of the variables passes, failures... see the code below...

#include <stdio.h>
int main (void) {
    int passes = 0;
    int failures = 0;
    int student = 1;
    int result;
    
    while ( student <= 10 ) {
        printf (" enter result ");
        scanf ("%d", &result);
        
         if ( result == 1 ){
             passes = passes + 1;
         }
        
         else {
          
         failures = failures + 1;
    }
    student = student + 1;
    }
    printf ("  passed %d\n",passes);
    
    printf ("  failed %d\n", failures);
    
    if (passes > 8) {
        
        printf (" bonus to instructor! \n");
        
    }
return 0;
}
 
 
Seriously??? i got bad errors because i left off the passes and failures in the last two printf statements?man do i have a lot to learn.thanks for your help samath.
 
ur welcome!