From 3e533069b005374a0b43ba7ab6de5f6e7b87a978 Mon Sep 17 00:00:00 2001 From: Viktor Daniv Date: Mon, 7 Oct 2024 12:37:02 +0000 Subject: [PATCH] Update cv3/program.c --- cv3/program.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cv3/program.c b/cv3/program.c index ca56b88..891e7bc 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -48,7 +48,7 @@ int perform_operation(Calculator *calc, char op) { if (!pop(calc, &b) || !pop(calc, &a)) { return 0; // Не вдалося вилучити два числа } - + int bub = 0; switch (op) { case '+': push(calc, a + b); @@ -62,9 +62,8 @@ int perform_operation(Calculator *calc, char op) { case '/': if (b == 0) { printf("division by zero\n"); + bub = 1; break; - } else { - printf("no input\n"); } push(calc, a / b); @@ -75,7 +74,9 @@ int perform_operation(Calculator *calc, char op) { } print_stack(calc); - + if(bub == 0) { + printf("no input\n"); + } return 1; }