int a; int b;   average_two_ints() {   (a + b) / 2; // What if (a + b) > INT_MAX ?  Overflow! // This does not do what you want 100% of the time   (a + b) >> 1; // Shifting... //   - Takes care of the sign bit by shifting it in ( http://en.wikipedia.org/wiki/Division_by_two#Binary //   - Shifts the lsb out to take care of units place ( oddint/2 == floor(oddint/2) ) // Does what you want 100% of the time (caveat: see your language spec (looking at you Java))   }   // Use practices that causes your code to be correct 100% of the time in your implementation // How would you catch something subtle like this? // Testing, testing, testing, repeatable testing, testing, test cases, testing // Good test cases are designed to ensure something works as expected for all input // Testing all input is unfeasible; average cases and edge cases