diff options
| author | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-12-07 18:29:20 +0800 |
|---|---|---|
| committer | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-12-07 18:29:20 +0800 |
| commit | bd9550e2e7f2484ccbd6f9c6d1d2a520dbddc82c (patch) | |
| tree | e45fa1999205d6b723a47ae2988130a06b5bc77d /4/3.c | |
| parent | 6e31f2496eda9d71152acaf5b8db576af0b141a8 (diff) | |
| download | k&r-exercises-bd9550e2e7f2484ccbd6f9c6d1d2a520dbddc82c.tar.gz | |
4.3
Diffstat (limited to '4/3.c')
| -rw-r--r-- | 4/3.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -48,6 +48,13 @@ int main(int argc, char *argv[]) { else printf("error: division by zero\n"); break; + case '%': + op2 = pop(); + if (op2 != 0.0) + push((int)pop() % (int)op2); + else + printf("error: division by zero\n"); + break; case '\n': printf("\t%.8g\n", pop()); break; |
