St. Bonaventure University
High School
Programming Contest

Addition

 

The Bug

    The bug is that if either input is zero, then the sum returns zero; otherwise it works correctly.  The code below should make this even clearer.

int sum (int a, int b) {
    if ((a==0) || (b==0)) {
        return 0;
    } else {
        return a+b;
    }
}