diff options
Diffstat (limited to 'stdlib/testdiv.c')
-rw-r--r-- | stdlib/testdiv.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/stdlib/testdiv.c b/stdlib/testdiv.c index a3ae5c9..9a5341c 100644 --- a/stdlib/testdiv.c +++ b/stdlib/testdiv.c @@ -22,11 +22,19 @@ int main (void) { + int err = 0; int i, j; while (scanf ("%d %d\n", &i, &j) == 2) { div_t d = div (i, j); - printf ("%d / %d = %d + %d/%d\n", i, j, d.quot, d.rem, j); + printf ("%d / %d = %d + %d/%d", i, j, d.quot, d.rem, j); + if (i == d.quot * j + d.rem) + fputs (" OK\n", stdout); + else + { + fputs (" FAILED\n", stdout); + err = 1; + } } - return 0; + return err; } |