Browse Source

Expanded arithmetic division by long datatype

remotes/origin/develop
Eric Bagus 11 months ago
parent
commit
7592aad08c
  1. 9
      src/arithmeticDivision.c
  2. 2
      src/arithmeticDivision.h

9
src/arithmeticDivision.c

@ -15,3 +15,12 @@ int* division_integer(int dividend, int divisor) {
*result = dividend / divisor; *result = dividend / divisor;
return result; return result;
} }
long* division_long(long num1, long num2) {
if(num2 == 0) {
return NULL;
}
long* result = malloc(sizeof(long));
*result = num1 / num2;
return result;
}

2
src/arithmeticDivision.h

@ -3,4 +3,6 @@
int* division_integer(int, int); int* division_integer(int, int);
long* division_long(long, long);
#endif //THEADMIRALS_ARITHMETICDIVISION_H #endif //THEADMIRALS_ARITHMETICDIVISION_H
Loading…
Cancel
Save