I tried to write an easy program that compares 3 numbers and prints the biggest of them but it keeps printing all 3 of them and I don\'t get why. That\'s my code:
You have a semicolon after your if condition:
if((x > y) && (x > z));
The semicolon takes the place of the block or statement to be executed when the condition is true. It's as if you had written:
if((x > y) && (x > z))
{
;
}
{
printf("%d",x);
}
You can hopefully see how this will execute the print statement unconditionally.