TOPIC

Problem with ifelse

kaline10 asked 3 years ago

I'd like to know how I use that if to print number lesser than 10

int main(){

float A, B, C, MEDIA;

scanf("%f %f %f", &A, &B, &C); printf("MEDIA = %f\n", ((A2)+(B3)+(C*5))/10); if(MEDIA <= 10){ }

else getchar;

}

Remember not post solutions. Your post may be reviewed by our moderators.

  • Joel Marques Martins replied 3 years ago

    You don't need to do that. You just need to read the three values and calculate the average and print it.

    For better precision, is always recomended to use double (in future problems will make a big diference !)

    And, in case it was necessary to use the if (which, it isn't at this case), the correct syntax would be

    if(condition){
        instructions...
    }
    
    if(media <= 10.0){
        printf(" ... ");
    }

    Hope I helped! :D