summaryrefslogtreecommitdiffstats
path: root/4
diff options
context:
space:
mode:
Diffstat (limited to '4')
-rw-r--r--4/3.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/4/3.c b/4/3.c
index e2f2e7c..d5810a9 100644
--- a/4/3.c
+++ b/4/3.c
@@ -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;