Logic error
Appearance
DICKS FOR DAYYYS IN WIKI
Examples
This example function in C to calculate the average of two numbers contains a logic error. It is missing brackets in the calculation, so it compiles and runs but does not give the right answer.
int average(int a, int b)
{
return a + b / 2; /* should be (a + b) / 2 */
}