3 ** This program tests the division and modulo operators
4 ** and the div() library function.
6 ** 2002-10-24, Greg King
13 static bool test(int dividend, int divisor) {
16 result = div(dividend, divisor);
17 printf("%+d/%+d= %+d, %+d%%%+d= %+d, div()= %+d, %+d\n",
18 dividend, divisor, dividend / divisor,
19 dividend, divisor, dividend % divisor,
20 result.quot, result.rem);
21 return result.quot * divisor + result.rem != dividend;
27 printf("\nTest of division and modulus operations:\n\n");
33 printf("\nThe div() function made a wrong result!\n");
35 /* Atari DOS 2 clears the screen after program-termination, so wait. */
36 printf("\nTap a key, to exit. ");