Browse Source

refactoring: if one a or b is zero just return the other

remotes/origin/userinput
fdai7968 11 months ago
parent
commit
3387438388
  1. 5
      src/subtraction/subtraction.c

5
src/subtraction/subtraction.c

@ -1,3 +1,6 @@
#include "subtraction.h"
int subtract(int a, int b) {
return a - b;
if (a==0) return b;
if(b==0) return a;
else return a - b;
}
Loading…
Cancel
Save